Skip to content

Commit

Permalink
CMR-10242: Fix /items/ path for collections which have granule meta…
Browse files Browse the repository at this point in the history
…data (#372)

CMR-10242: Appended '/items' to link of rel=items for CMR collections with granules
---------

Co-authored-by: doug-newman-nasa <[email protected]>
  • Loading branch information
doug-newman-nasa and doug-newman-nasa authored Nov 6, 2024
1 parent bf75528 commit 82d4a9b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/routes/__tests__/browse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("addItemLinkIfPresent", () => {

const numberoOfLinks = stacCollection.links.length;
// Invoke method
addItemLinkIfPresent(stacCollection, "https://foo.com/items");
addItemLinkIfPresent(stacCollection, "https://foo.com");
// Observe an addiitonal link in the STAC Collection with rel=items etc.
expect(stacCollection.links.length).to.equal(numberoOfLinks + 1);
expect(stacCollection).to.have.deep.property("links", [
Expand Down
3 changes: 1 addition & 2 deletions src/routes/browse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const collectionsHandler = async (req: Request, res: Response): Promise<v
href: encodeURI(stacRoot),
type: "application/json",
});

addItemLinkIfPresent(collection, `${getBaseUrl(self)}/${encodeURIComponent(collection.id)}`);
});

Expand Down Expand Up @@ -125,7 +124,7 @@ export function addItemLinkIfPresent(collection: STACCollection, url: string) {
if (!itemsLink) {
collection.links.push({
rel: "items",
href: url,
href: `${url}/items`,
type: "application/geo+json",
title: "Collection Items",
});
Expand Down

0 comments on commit 82d4a9b

Please sign in to comment.