Skip to content

Commit

Permalink
Merge pull request #405 from microbiomedata/402-redirect-to-portal-la…
Browse files Browse the repository at this point in the history
…nding-pages

feat: redirect to data portal landing pages for sty-, bsm-
  • Loading branch information
PeopleMakeCulture authored Dec 5, 2023
2 parents eaefd28 + c7691a5 commit 61e8ce4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nmdc_runtime/api/endpoints/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def get_object_info(
) # TODO use HEAD when enabled upstream
if rv.status_code != 404:
return RedirectResponse(
url_to_try, status_code=status.HTTP_307_TEMPORARY_REDIRECT
f"https://data.microbiomedata.org/details/study/nmdc:{object_id}",
status_code=status.HTTP_307_TEMPORARY_REDIRECT,
)
elif object_id.startswith("bsm"):
url_to_try = f"https://data.microbiomedata.org/api/biosample/nmdc:{object_id}"
Expand All @@ -132,7 +133,8 @@ def get_object_info(
) # TODO use HEAD when enabled upstream
if rv.status_code != 404:
return RedirectResponse(
url_to_try, status_code=status.HTTP_307_TEMPORARY_REDIRECT
f"https://data.microbiomedata.org/details/sample/nmdc:{object_id}",
status_code=status.HTTP_307_TEMPORARY_REDIRECT,
)

# If "sty" or "bsm" ID doesn't have preferred landing page (above), try for JSON payload
Expand Down

0 comments on commit 61e8ce4

Please sign in to comment.