[Fix] Site .env: stop escaping double quotes in values that never needed quoting - #1228
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR updates environment-value parsing and stringification. It adds quote selection, escaping for special characters, carriage-return parsing, and coverage for JSON values and uploaded ChangesEnvironment serialisation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/Helpers/EnvParser.php`:
- Around line 194-195: Update EnvParser::stringify() to escape carriage returns
as the literal \r sequence alongside backslashes, newlines, and quotes; update
the double-quoted parsing logic to decode that escape back to an actual carriage
return. Adjust the carriage-return round-trip test to assert the escaped on-disk
representation while preserving the original value after reload.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 8080d6eb-6060-4ab8-86be-a423afb04e8c
📒 Files selected for processing (3)
app/Helpers/EnvParser.phptests/Feature/ApplicationTest.phptests/Unit/EnvParserTest.php
EnvParser::stringify() treated any " or ' in a value as requiring double-quote wrapping plus backslash escaping, which rewrote valid JSON like ["ideal","paybybank"] as "["ideal","paybybank"]" and broke Vite and other consumers that don't unescape quotes - it now emits the minimal dotenv form (bare when safe, single-quoted when that avoids escaping, double-quoted-and-escaped otherwise), which also heals already-corrupted files on the next save.
Closes #1227
Summary by CodeRabbit
Bug Fixes
Tests