Repository navigation
edit: escape backslashes when quoting dotenv values on write - #450
Conversation
|
Thanks! The round trip through magpie's own reader is right, but the file's real reader is Gemini CLI, and its dotenv (npm |
|
Thanks, that makes sense. Merged current main (clean, #439's parser is preserved) and pushed 0571cc0. Values that need quoting are now written single-quoted when they contain no I checked the single-quoted path against the current npm |
|
Thanks — re-reviewed at 0571cc0, merged onto current main: looks good to merge. I checked the written file against the dotenv parser bundled in Gemini CLI 0.62.0 (copied verbatim from the bundle), npm dotenv 17.4.2, python-dotenv 1.2.4, godotenv 1.5.1 and magpie's
(Only remaining corner, not blocking: a value with both |
…plugins #450) workbuddy 0.1.41 (plugins #450, MYCF711) sends a package with no cycle total as a "Prepaid credits" balance window (#3950). npm view --prefer-online showed 0.1.41 before this change. Run on mote at this tree: gofmt -l internal/provider (clean), go vet ./internal/provider, go test -tags nogui -run 'Mover|Moved|Migrat| WorkBuddy|Min' ./internal/provider ok. Not run: the full suite (a one-line version string).
SetEnvFile quotes a value containing a space or special character as a double-quoted dotenv string but only escapes double quotes, not backslashes. A Windows path like MODEL_DIR=C:\new folder\tmp is written as "C:\new folder\tmp", and any dotenv reader that expands escapes (GetEnvFile does, and Gemini CLI's own dotenv does the same) reads it back as "C:ew foldertmp". The file is corrupted on first write.
Escape backslashes before escaping quotes in the quoting branch, so the written form round-trips exactly.