Skip to content

Preview every id shape, not just the underscored ones - #122

Merged
Robbie1977 merged 1 commit into
mainfrom
fix/preview-id-pattern
Sep 22, 2026
Merged

Robbie1977 merged 1 commit into
mainfrom
fix/preview-id-pattern

Conversation

@Robbie1977

Copy link
Copy Markdown
Contributor

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).

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.
@Robbie1977
Robbie1977 merged commit 1b550f5 into main Sep 22, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant