Fix: Extract object ID if URL is returned (#5596)

This commit is contained in:
Mike
2025-09-30 11:25:53 +02:00
committed by GitHub
parent 4aaaa2a626
commit 701130bb44
@@ -99,6 +99,13 @@ export function getTargetObjectIds(object: Record<string, unknown> | SpeckleObje
.filter((id) => !!id && typeof id === 'string')
}
// Handles both actual collection objecs( ala IFC) and individual objects
if (object.id && typeof object.id === 'string') return [object.id]
if (object.id && typeof object.id === 'string') {
// Extract object ID from URL if it's a full URL
// or return the ID as-is if it's already just an object ID
const objectId = object.id.includes('/objects/')
? object.id.split('/').reverse()[0]
: object.id
return [objectId]
}
return []
}