Repository navigation
Refactor: give the stats widget one base-URL rule - #15
Merged
Merged
Conversation
The widget normalised an upstream base URL three ways: a local diskBase helper and two inline copies, one of which stripped a single trailing slash where ctx.normalizeBase strips several and also trims. All four call sites use ctx.normalizeBase now, so a URL entered with a trailing space or two slashes behaves the same wherever it is used. A scan keeps the rule. connections is exempt and says why: its normBase leaves a trailing slash in place, which is a different rule rather than a copy.
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.
Summary
diskBasefromui/widgets/stats/data.jsand replace it, plus the two inline copies indiskHealthScrutinyanddiskHealthTrueNas, withctx.normalizeBase.diskBaseand the inline form stripped a single trailing slash,ctx.normalizeBasestrips several and trims whitespace. Which spelling a URL met decided whether a value entered with a trailing space or a double slash reached the service.ctxalready provides.connectionsis exempt with the reason recorded: itsnormBasedeliberately leaves a trailing slash in place, and one of its three call sites strips slashes itself.Testing
All green. Added 1 test; mutation-checked by restoring a hand-rolled scheme check, which fails it.
Checklist