ui: serve static assets on Windows#8900
Open
aeron-gh wants to merge 2 commits into
Open
Conversation
Signed-off-by: aeron-gh <agab0323@gmail.com>
Signed-off-by: aeron-gh <agab0323@gmail.com>
Author
|
the failing Doc check is unrelated to this change. All the code checks pass; a re-run of that job should clear it |
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.
On Windows the web UI fails to load — every
/static/*request (the React JS/CSS bundles) returns 404, so you end up with a blank page.The
/static/*filepathhandler builds the asset path withfilepath.Join, which uses the OS separator (\on Windows). The assets are served from anembed.FS, andio/fspaths are always forward-slash separated regardless of OS, so the lookup never matches and the asset 404s.path.Joinkeeps the path slash-separated on every platform.Same
filepath.Join→path.Joinclass as #8361, just in a different spot (that one is about object-storage keys, this is the embedded UI).Changes
pkg/ui/ui.go: usepath.Joininstead offilepath.Joinwhen resolving embedded static assets.Verification
Added
TestServeStaticAsset, which requests a real embedded asset through the/static/*filepathroute and asserts it returns 200 with the file contents. It fails (404) withfilepath.Joinon Windows and passes withpath.Join.