Log: sanitize newlines in comment bodies to preserve one-entry-per-line#30
Closed
Log: sanitize newlines in comment bodies to preserve one-entry-per-line#30
Conversation
03a98ac to
27a1a60
Compare
Replace literal newlines in comment.body with spaces before writing to deleted_comments.txt, ensuring each log entry stays on a single line and the file remains easy to parse. Applied across commentCleaner.py (all 3 modes), weekly_cleanup.py, and web/app.py. https://claude.ai/code/session_014HLhrFtCVRFnEyfRexiy3d
27a1a60 to
0549a23
Compare
Owner
Author
|
"Superseded by #33" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Reddit comment bodies can contain newlines. When written directly into the log file a single multi-line comment becomes multiple lines, breaking the "one entry = one line" invariant and making the log impossible to parse reliably with
wc -l,grep, etc.Fix
Replace
\nwith the literal two-character escape\\nbefore writing. The body is stored unambiguously on a single line; any reader that wants the original formatting can simply call.replace("\\n", "\n").Files changed
commentCleaner.py(modes 1/2/3),weekly_cleanup.py,web/app.pyhttps://claude.ai/code/session_014HLhrFtCVRFnEyfRexiy3d