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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user