Preview every id shape, not just the underscored ones - #122
Merged
Merged
Conversation
The id pattern required an underscore, so get_preview answered 400 for every FlyBase id and every dataset or publication -- FBgn0038978, FBtp0106402, FBti0004391, FBrf0247641, FBal0331598, Court2017, Chiang2010 -- although get_term_info resolves all of them, and the datasets even carry thumbnails. Those are a large share of real /reports/ traffic, and a dataset is exactly the sort of link someone shares. Widened to [A-Za-z][A-Za-z0-9_]+ : letters, digits and underscores from a letter. It still refuses the label-style URLs FlyBase points at VFB thumbnails (braces, spaces, a slash) and anything with a path in it. Over-matching is cheap here. get_term_info answers 200 with an empty shell for an id it does not know, every field null, so the preview handlers now require a Name as well as an Id and 404 otherwise -- which is what lets a caller fall back to its ordinary redirect instead of being handed a blank card. Tests cover all three id families, the empty shell, and the FlyBase label URL.
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.
The id pattern required an underscore, so get_preview answered 400 for every
FlyBase id and every dataset or publication -- FBgn0038978, FBtp0106402,
FBti0004391, FBrf0247641, FBal0331598, Court2017, Chiang2010 -- although
get_term_info resolves all of them, and the datasets even carry thumbnails.
Those are a large share of real /reports/ traffic, and a dataset is exactly
the sort of link someone shares.
Widened to [A-Za-z][A-Za-z0-9_]+ : letters, digits and underscores from a
letter. It still refuses the label-style URLs FlyBase points at VFB thumbnails
(braces, spaces, a slash) and anything with a path in it.
Over-matching is cheap here. get_term_info answers 200 with an empty shell for
an id it does not know, every field null, so the preview handlers now require a
Name as well as an Id and 404 otherwise -- which is what lets a caller fall back
to its ordinary redirect instead of being handed a blank card.
Tests cover all three id families, the empty shell, and the FlyBase label URL
(38 passing).