Repository navigation
Use forward slashes in Windows sourcemap upload keys - #1063
Open
pcbeingused33 wants to merge 1 commit into
Open
pcbeingused33 wants to merge 1 commit into
pcbeingused33 wants to merge 1 commit into
Conversation
pcbeingused33
requested review from
ld-ahartmann
and removed request for
a team
November 30, 2026 14:07
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.
Requirements
Related issues
None filed. On Windows,
ldcli sourcemaps upload <dir>builds the object keys fromfilepath.Rel, so a file atdist\(dashboard)\page.js.mapis uploaded as<version>/<base>/dist\(dashboard)\page.js.map. The route-group pattern\(.+?\)/only matches forward slashes, so the alias without the route group (dist/page.js.map) is never uploaded either. The keys then don't match the forward-slash paths that the browser reports, and the uploaded sourcemaps are not found.Describe the solution you've provided
getAllSourceMapFilesconverts the relative name to forward slashes withfilepath.ToSlashbefore it builds the key and removes route groups, the same waycmd/symbols/android_sources.goalready handles Windows paths.Pathkeeps the native path, so the file is still opened from disk the same way as before. Nothing changes on Linux or macOS, whereToSlashdoes nothing.TestGetAllSourceMapFilesRouteGroupKeyscreatesdist/(dashboard)/page.js.mapwith native separators. It checks that both keys (v1/assets/dist/(dashboard)/page.js.mapandv1/assets/dist/page.js.map) are produced and that both entries point to the native file path.Testing:
go test ./cmd/sourcemapspasses.GOOS=windows): the new test fails onmainwith the single keyv1/assets/dist\(dashboard)\page.js.mapand no alias, and passes with this change.TestGetAllSourceMapFilesalready fails on Windows onmain, because it comparesPathwith a path joined using/. That failure is unrelated, and this change does not alter it.Describe alternatives you've considered
Changing the regex to accept both
/and\would bring back the alias, but the keys would still contain backslashes.Additional context
This change was prepared with AI assistance.
Note
Overview
Sourcemap upload keys on Windows now use forward slashes, so S3/object paths match what browsers report and route-group stripping works again.
In
getAllSourceMapFiles, the relative path used forNameand for the(…)/route-group regex is normalized withfilepath.ToSlashbefore building upload keys and aliases;Pathstays OS-native so files are still read from disk correctly. On Unix this is a no-op.Adds
TestGetAllSourceMapFilesRouteGroupKeysto assert both the full path key (dist/(dashboard)/page.js.map) and the route-group alias (dist/page.js.map) are emitted.Reviewed by Cursor Bugbot for commit 610a6d5. Bugbot is set up for automated code reviews on this repo. Configure here.