fix(paste): switch from dpaste to rentry.co#253
Merged
Conversation
dpaste.com started returning 400s. Move upload_to_paste to rentry.co, a markdown-rendering paste service: prime the csrftoken cookie, then POST the content with the matching csrfmiddlewaretoken and a Referer header. Title is prepended as a markdown heading; the dropped expiry_days param wasn't used by the only caller. When the upload fails, the AI explanation now appends "⚠️ Couldn't post full report" instead of silently omitting the link. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
dpaste.comstarted returning400 Bad Request:That paste link carries the AI explanation's full detail from Telegram alerts, so it needs a reliable, markdown-rendering host.
Change
utils/paste.pynow uploads to rentry.co (markdown paste service). The flow: prime thecsrftokencookie with a GET, then POSTtext+ matchingcsrfmiddlewaretokenwith aRefererheader; the URL comes back in the JSON body.titleis prepended as a top-level markdown heading (rentry has no separate title field).expiry_daysparam (the only caller never passed it; rentry has no anonymous-API expiry control).ai_explainer.format_explanation_line: on upload failure, append⚠️ Couldn't post full reportinstead of silently dropping the link.Verified live
Real upload succeeded and the rendered page returns 200 with our markdown:
https://rentry.co/<id>(Note: rentry's
/rawendpoint now requires an access code, but we link the normal rendered page, which is unaffected.)Testing
tests/test_paste.pyrewritten for the CSRF flow: success, no-title, missing-csrftoken, non-200 status, request failure.tests/test_ai_explainer.py: updated paste URL + asserts the failure notice.ruffclean.🤖 Generated with Claude Code