Download and store article images locally #21
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Media extraction records image URLs, but the images themselves are still loaded from the origin on every view — slow, and lost when the origin removes them or rejects us (see the 403 lessons from issue #2).
Goal
Findings
media_extractoralready discovers image URLs anddb/mediastores them per article; only the bytes are missing.Plan of attack
storedflag in the media schema (alembic migration if needed).Resolved by PR #29 (merged): article images are downloaded at fetch time (browser User-Agent, raster-only whitelist excluding SVG, streamed with a hard size cap, SSRF guard with per-hop redirect re-validation) and served locally from
/media/<hash>with templates preferring the local copy. Files live in amedia/directory beside the database; the media table gainedlocal_filename/downloaded_at. Also folded in: the RenewEconomy extraction fix (images carried only in the entry summary are now discovered) and the missingget_next_aggregate_with_unreadtest lost in PR #28.