Skip to content

Use forward slashes in Windows sourcemap upload keys - #1063

Open
pcbeingused33 wants to merge 1 commit into
launchdarkly:mainfrom
pcbeingused33:fix/ldcli-sourcemaps-windows
Open

pcbeingused33 wants to merge 1 commit into
launchdarkly:mainfrom
pcbeingused33:fix/ldcli-sourcemaps-windows

Conversation

@pcbeingused33

@pcbeingused33 pcbeingused33 commented Nov 30, 2026 •

Copy link
Copy Markdown

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

None filed. On Windows, ldcli sourcemaps upload <dir> builds the object keys from filepath.Rel, so a file at dist\(dashboard)\page.js.map is 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

getAllSourceMapFiles converts the relative name to forward slashes with filepath.ToSlash before it builds the key and removes route groups, the same way cmd/symbols/android_sources.go already handles Windows paths. Path keeps the native path, so the file is still opened from disk the same way as before. Nothing changes on Linux or macOS, where ToSlash does nothing.

TestGetAllSourceMapFilesRouteGroupKeys creates dist/(dashboard)/page.js.map with native separators. It checks that both keys (v1/assets/dist/(dashboard)/page.js.map and v1/assets/dist/page.js.map) are produced and that both entries point to the native file path.

Testing:

  • Linux: go test ./cmd/sourcemaps passes.
  • Windows (native run of the test binary built with GOOS=windows): the new test fails on main with the single key v1/assets/dist\(dashboard)\page.js.map and no alias, and passes with this change. TestGetAllSourceMapFiles already fails on Windows on main, because it compares Path with 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 for Name and for the (…)/ route-group regex is normalized with filepath.ToSlash before building upload keys and aliases; Path stays OS-native so files are still read from disk correctly. On Unix this is a no-op.

Adds TestGetAllSourceMapFilesRouteGroupKeys to 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.

@pcbeingused33
pcbeingused33 requested a review from a team as a code owner November 30, 2026 14:07
@pcbeingused33
pcbeingused33 requested review from ld-ahartmann and removed request for a team November 30, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant