[static querystring] Extract URL parsing into a reusable codec - #12088
Open
LitoMore wants to merge 1 commit into
Open
[static querystring] Extract URL parsing into a reusable codec#12088LitoMore wants to merge 1 commit into
LitoMore wants to merge 1 commit into
Conversation
Contributor
Member
Author
|
The service test skipped due to a PR description modification. I've created a PR to try to solve this problem. See: |
Member
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.
Extract the static badge URL grammar into a reusable, side-effect-free codec.
This is a useful utility for other self-hosted services to use the same badge path logic. Maybe we can expose this through
badge-makerin the future.And it useful for our OpenAPI doc pages. Then we can break down
badgeContentinto label, message, and color, which will be more intuitive for users.Changes
parseStaticBadgePath()for parsing static badge paths and optional query strings.formatStaticBadgePath()for generating equivalent static badge URLs.label,color, and legacycolorBquery overrides.link.StaticBadgeso the parser and service share the same definition.parsePathhook toBaseStaticService.escapeFormat()as a backwards-compatible alias for the extracted decoder.Color normalization and rendering-specific query behavior remain in the existing badge pipeline.
Compatibility
The existing static badge HTTP route continues to use the same path grammar and query override pipeline. The query-string static badge endpoint (
/static/v1) is unchanged.The formatter only rejects values that cannot be represented by the path grammar unless an appropriate query override is supplied.