Fix translate-and-adapt for in-app articles (silent failure)#644
Merged
Conversation
When a user opened a foreign-language article in the reader and chose "Translate to my level", the request silently failed and nothing happened. Two compounding bugs: - The endpoint re-downloaded the article's stored URL through readability. For articles whose stored URL is a Zeeguu reader link (a JS page), the download failed; the code then fell through and used the never-assigned `article_obj`, raising UnboundLocalError -> HTTP 500. - The web reader swallowed that error and just closed the modal. The endpoint now accepts `article_id` and translates the already-stored article content directly (no re-download, no readability dependency), reusing its image. The URL path is kept for external shares but now aborts cleanly (502) instead of crashing when a fetch fails. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
|
ArchLens - No architecturally relevant changes to the existing views |
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.
Summary
A user opened a foreign-language article in the reader, chose Translate to my level, saw "Translating…", and then nothing happened. Reproduced from logs:
Two compounding bugs (this PR is the backend half):
/translate_and_adapt_articlere-downloaded the article's stored URL through readability. For articles whose stored URL is a Zeeguu reader link (zeeguu.org/read/article?id=…, a JS SPA), the download failed — and the code then fell through and used the never-assignedarticle_obj, raisingUnboundLocalError→ HTTP 500.Changes
article_idand translates the already-stored article content directly — no re-download, no readability dependency — and reuses the stored image.abort(502)cleanly instead of crashing when a fetch fails.Companion PR
claude/translate-adapt-stored-article(passesarticle_id, graceful fallback)Test plan
🤖 Generated with Claude Code