fix: respect base path in minified UI HTML - #6227
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a regression where Chronograf 1.11.x failed to apply BASE_PATH to UI asset URLs in minified HTML produced by parcel ≥ 2.15, which emits unquoted attribute values and a boolean data-basepath attribute. The existing prefixer matched only quoted forms (src=", href=", data-basepath="), leaving minified output unprefixed.
Changes:
- Add new prefixer attributes for unquoted
src=/,href=/, and booleandata-basepath, with handlers that emit the correct prefixed form while preserving protocol-relative (//) URLs. - Harden the read loop to handle short reads when priming the buffer, empty windows, and bounds-check the
matchcomparison. - Add tests for minified HTML rewriting and a CHANGELOG entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| server/url_prefixer.go | Adds match cases for minified src=/, href=/, and boolean data-basepath; bounds-checks subject slicing; restructures main loop to handle EOF and empty buffer safely. |
| server/url_prefixer_test.go | Adds Test_Server_Prefixer_RewritesMinifiedHTML covering unquoted attrs, empty/quoted data-basepath, and a full minified index HTML. |
| CHANGELOG.md | Adds 1.11.4 "unreleased" bug-fix entry linking PR #6227. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Smoke testBuilt the latest commit (583ff46) locally in cross-builder and started the After connecting the results to a local instance of Influxdb3 Core, it appears that the resource contexts are working correctly now.
With ENVARS N.B. also restarted using ENVARS as described in #6226... This also works...
|
karel-rehor
left a comment
There was a problem hiding this comment.
Manual verification of original issue from build works
Local tests pass.
Changes make sense.
Looks good to me. 🚴 🏁
|
Thanks for identifying and resolving the problem! Will this be released asap as part of v1.11.4? I'm stuck for now at v1.10 |


Closes #6226
parcelnewer HTML minifier (since v2.15) ) can emit unquoted asset attributes and a boolean data-basepath. The existing prefixer only handled quoted attributes, so UI assets were not rewritten when Chronograf was served under a non-root base path.This PR updates the prefixer to handle minified
src=/...,href=/..., and booleandata-basepathforms while preserving existing quoted behavior.