Fix incorrect data.bioontology.org URL in 'ontology already exists' 409 error - #185
Merged
Merged
Conversation
The 409 error returned when creating an ontology with an existing acronym interpolated ont.id directly, exposing the internal id_url_prefix (http://data.bioontology.org/) instead of the portal's public URL. Run the id through Base.replace_url_id_to_prefix so the message reports the configured rest_url_prefix, matching normal serialized output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue: ontoportal-astro/project-management#45
Problem
Creating an ontology with an acronym that already exists returns a
409whose message exposes the internal id prefix (http://data.bioontology.org/) instead of the portal's public URL:{ "errors": [ "Ontology already exists, see http://data.bioontology.org/ontologies/AGROVOC\n To add a new submission, POST to: /ontologies/AGROVOC/submission.\n To modify the resource, use PATCH.\n" ], "status": 409 }The
http://data.bioontology.org/...URL is wrong for any non-BioPortal deployment (e.g. AgroPortal).Fix
Run the id through
LinkedData::Models::Base.replace_url_id_to_prefix(ont.id), which convertsid_url_prefix→rest_url_prefix