Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/client/api/catalog/CSW.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function getThumbnailFromDc(dc, options) {
const URI = dc?.URI && castArray(dc.URI);
let thumbURL;
if (URI) {
const thumb = head(URI.filter(uri => uri.name === 'thumbnail')) || head(URI.filter(uri => !uri.name && uri.protocol?.indexOf('image/') > -1));
const thumb = head(URI.filter(uri => uri.name === 'thumbnail')) || head(URI.filter(uri => uri.protocol?.indexOf('image/') > -1));
thumbURL = thumb ? thumb.value : null;
}
if (!thumbURL && dc && dc.references) {
Expand Down
16 changes: 16 additions & 0 deletions web/client/api/catalog/__tests__/CSW-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,22 @@ describe('Test correctness of the CSW catalog APIs', () => {
expect(records[0].thumbnail).toBe("/thumb");
});

it('csw with DC thumbnail from dc:URI with non-thumbnail name and image protocol (#10504)', () => {
const cswRecords = [{
dc: {
URI: [{
TYPE_NAME: 'DC_1_1.URI',
protocol: 'image/png',
name: 'My description',
value: 'https://site.com/img/fish.png'
}]
}
}];
const records = getCatalogRecords({ records: cswRecords }, {});
expect(records.length).toBe(1);
expect(records[0].thumbnail).toBe('https://site.com/img/fish.png');
});

it('csw with DC references, no url, with thumbnail, with uri', () => {
const cswRecords = [{
dc: {
Expand Down
Loading