Skip to content

fix: double escape windows path in receipt - #2313

Merged
mistydemeo merged 7 commits into
axodotdev:mainfrom
eegli:fix/windows-posix-double-escape-path-receipt
May 16, 2026
Merged

mistydemeo merged 7 commits into
axodotdev:mainfrom
eegli:fix/windows-posix-double-escape-path-receipt

Conversation

@eegli

@eegli eegli commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up fix for #2227. Good news: We're halfway there with supporting Windows. However, on Git Bash/MSYS/MINGW environments, the uv-receipt.json now contains unescaped backslashes in the install_prefix field, which is invalid JSON:

{"install_prefix":"C:\Users\username\.local\bin",...}

Root Cause

The convert_path_for_receipt() function outputs escaped backslashes (\\), but these are later inserted via command substitution into a double-quoted sed command:

RECEIPT=$(echo "$RECEIPT" | sed "s,AXO_INSTALL_PREFIX,$(convert_path_for_receipt "$_receipt_install_dir"),")

Inside double quotes, the shell processes \\ as an escape sequence, which reduces each pair to a single backslash before sed executes. This results in unescaped backslashes. With this change, we output 4 backslashes per original backslash, which get reduced to two again. Essentially:

sed "s,AXO_INSTALL_PREFIX,C:\\\\Users\\\\test" -> Correct JSON

Refactored it a little so the whole receipt path conversion logic is not spread all over the place

@eegli
eegli marked this pull request as ready for review March 2, 2026 15:38
@eegli

eegli commented Mar 28, 2026

Copy link
Copy Markdown
Contributor Author

@mistydemeo can we merge this?

@mistydemeo

Copy link
Copy Markdown
Contributor

Yes, sorry for the delay reviewing this. Just need to check something before merging!

@eegli

eegli commented Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

No worries, let me know if I can help out @mistydemeo

@eegli

eegli commented May 10, 2026

Copy link
Copy Markdown
Contributor Author

Can we merge?

@mistydemeo

Copy link
Copy Markdown
Contributor

Yeah, sorry - just need to get the time to test this before merging.

@mistydemeo mistydemeo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

Sorry again for the delay. Started a new job recently and it's kept me very busy.

@mistydemeo
mistydemeo merged commit 7bbefa3 into axodotdev:main May 16, 2026
24 of 25 checks passed
@eegli
eegli deleted the fix/windows-posix-double-escape-path-receipt branch May 21, 2026 15:54
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.

2 participants