-
-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep newline/tab escapes in quoted strings (fix certificate serializing) #296
Conversation
PR was closed by mistake. Reopened it. |
Keep escape backslash for newline/tab characters. Parsing still differs from shell syntax but keeps string structure intact. Example certificate data VAR="---BEGIN---\r\n---END---" now becomes "---BEGIN---\r\n---END---" instead of "---BEGIN---rn---END---"
b425927
to
6080f4d
Compare
I've rebased this onto the latest |
I'll review this PR ASAP. Thank you for the contributing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Merged! Thank you for the patch, and for helping us make django-environ better. |
…ng) (#296) Limit backslash escape removal for quoted newlines Keep escape backslash for newline/tab characters. Parsing still differs from shell syntax but keeps string structure intact. Example certificate data VAR="---BEGIN---\r\n---END---" now becomes "---BEGIN---\r\n---END---" instead of "---BEGIN---rn---END---" Co-authored-by: Serghei Iakovlev <egrep@protonmail.ch>
Change parsing of quoted strings to not remove \ before \r, \n and \t to allow basic formatting and certificate serializing.
Also include optional \r in delimiter when splitting string to multiple lines for better compatibility with PEM-certificates and MIME-headers
Example certificate data
VAR="---BEGIN---\r\n---END---"
now becomes
r"---BEGIN---\r\n---END---"
instead of
r"---BEGIN---rn---END---"
This makes linebreaks work correctly with Env().str('VAR', multiline=True) as well