harvard-lil / h2o

H2O is a web app for creating and reading open educational resources, primarily in the legal field
https://opencasebook.org
GNU Affero General Public License v3.0
36 stars 30 forks source link

Links to GPO from search results don't work #1959

Closed lizadaly closed 1 year ago

lizadaly commented 1 year ago

Not sure when this broke, but the API response from the backend doesn't return any values for GPO urls, so the front end has nothing to point to when the user tries to click the external links on the right:

image

Example from CAP:

<a data-v-5412d700="" href="https://cite.case.law/so-2d/782/339/" target="_blank" rel="noopener noreferrer">CAP</a>

Example from GPO:

<a data-v-5412d700="" target="_blank" rel="noopener noreferrer">GPO</a>

The API response isn't adding a url value here:

{"fullName": "Copies of Supplements to Code of Laws of United States and of District of Columbia Code and Supplements; conclusive evidence of original", 
"shortName": "Copies of Supplements to Code of Laws of United States and of District of Columbia C...", 
"fullCitations": "1 U.S.C. \u00a7 209", 
"shortCitations": "1 U.S.C. \u00a7 209", 
"effectiveDate": "2018-01-01", 
"url": null, 
"id": "USCODE-2018-title1-chap3-sec209"}
lizadaly commented 1 year ago

Fixed by removing the anchor when no link is present; if there could be a link here, it needs to be mapped from the data that we have.