Merge pull request #30489 from dingledorf/patch-3

Fix getLocationByEntity to use `original_value` instead of `value` when querying search table
This commit is contained in:
Fredrik Adelöw
2025-08-11 11:26:19 +02:00
committed by GitHub
3 changed files with 9 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Fixed getLocationByEntity to use `original_value` instead of `value` when querying search table
@@ -211,6 +211,7 @@ describe('DefaultLocationStore', () => {
entity_id: entityId,
key: `metadata.annotations.${ANNOTATION_ORIGIN_LOCATION}`,
value: `url:https://example.com`,
original_value: `url:https://example.com`,
});
await knex<DbLocationsRow>('locations').insert({
@@ -137,15 +137,15 @@ export class DefaultLocationStore implements LocationStore, EntityProvider {
entity_id: entityRow.entity_id,
key: `metadata.annotations.${ANNOTATION_ORIGIN_LOCATION}`,
})
.select('value')
.select('original_value')
.limit(1);
if (!searchRow?.value) {
if (!searchRow?.original_value) {
throw new NotFoundError(
`found no origin annotation for ref ${entityRefString}`,
);
}
const { type, target } = parseLocationRef(searchRow.value);
const { type, target } = parseLocationRef(searchRow.original_value);
const [locationRow] = await this.db<DbLocationsRow>('locations')
.where({ type, target })
.select()