From 8bfbabb425ae701e9b59b2f6f97b7a682da4de5a Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Mon, 22 May 2023 15:59:20 +0200 Subject: [PATCH] The search link MUST be 'application/geo+json' as otherwise it's likely not STAC. See https://github.com/opengeospatial/ogcapi-features/issues/832 --- src/models/stac.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/models/stac.js b/src/models/stac.js index 8a14d267f..4e7bf311b 100644 --- a/src/models/stac.js +++ b/src/models/stac.js @@ -1,4 +1,4 @@ -import Utils from "../utils"; +import Utils, { geojsonMediaType } from "../utils"; import Migrate from '@radiantearth/stac-migrate'; import { getBest } from '../locale-id'; @@ -145,7 +145,10 @@ class STAC { } getSearchLink() { - let links = this.getStacLinksWithRel('search'); + // The search link MUST be 'application/geo+json' as otherwise it's likely not STAC + // See https://github.com/opengeospatial/ogcapi-features/issues/832 + let links = Utils.getLinksWithRels(this.links, ['search']) + .filter(link => Utils.isMediaType(link.type, geojsonMediaType)); // Prefer POST if present let post = links.find(link => Utils.hasText(link.method) && link.method.toUpperCase() === 'POST'); return post || links[0] || null;