Skip to content

Log: sanitize newlines in comment bodies to preserve one-entry-per-line#30

Closed
DaLuSt wants to merge 1 commit intomainfrom
claude/log-sanitize-body-newlines-7Wp79
Closed

Log: sanitize newlines in comment bodies to preserve one-entry-per-line#30
DaLuSt wants to merge 1 commit intomainfrom
claude/log-sanitize-body-newlines-7Wp79

Conversation

@DaLuSt
Copy link
Copy Markdown
Owner

@DaLuSt DaLuSt commented Feb 21, 2026

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 \n with the literal two-character escape \\n before 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.py

https://claude.ai/code/session_014HLhrFtCVRFnEyfRexiy3d

@DaLuSt DaLuSt force-pushed the claude/log-sanitize-body-newlines-7Wp79 branch from 03a98ac to 27a1a60 Compare February 21, 2026 22:13
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
@DaLuSt DaLuSt force-pushed the claude/log-sanitize-body-newlines-7Wp79 branch from 27a1a60 to 0549a23 Compare February 27, 2026 09:00
@DaLuSt
Copy link
Copy Markdown
Owner Author

DaLuSt commented Feb 27, 2026

"Superseded by #33"

@DaLuSt DaLuSt closed this Feb 27, 2026
@DaLuSt DaLuSt deleted the claude/log-sanitize-body-newlines-7Wp79 branch February 27, 2026 16:16
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