Repository navigation
Import a picture by its address - #79
Merged
Merged
Conversation
POST /api/assets/import-image downloads one picture and catalogues it through the upload's own ingest, for Video Creator's image search. Inline rather than queued: the caller is waiting to place it, and it is one bounded download. The SSRF check runs on every hop; the server's type names the file, a page answering for a picture is refused, SVG is never taken from the web. A repeat is caught by address, then by checksum, and returns the existing asset. The page is recorded as the source, with retrieved_at and the search's description, stamped embedded; licence and creator stay empty because no search knows them. download_image sits beside download_audio in ingest/web.py, which now share one streaming download. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1geD3rf5gNTeFwCtstRx7
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
The GAM part of letting Video Creator find pictures on the web for backgrounds and overlays. GVC finds them through Gecko Suite's image search (davior/gecko-suite#25), the person picks one, and GVC files it here with this endpoint.
POST /api/assets/import-image{image_url, page_url?, title?, description?, tags?}returns201with the new asset, or200with the copy already held.ingest_file.ingest/web.py's rules (an SSRF check on every redirect hop, uncompressed bodies only, capped while arriving).download_imagesits besidedownload_audio, which now share one streaming download.Content-Typefirst, the path's extension as the fallback. A page answering for a picture (a hotlink guard) is refused, and SVG is never taken from the web.source_url(the page when known),retrieved_atand the search's description, stampedembedded. Licence and creator stay empty, since no search backend knows them.docs/image-import.mdrecords the decisions.page_import._same_filebecame the publicsame_file, used by both.Test plan
cd backend && pytest -q: 1631 passed.tests/test_image_import.pycovers import and credit, both duplicate paths, type from the server, a page refused, SVG refused, an inward address and an inward redirect, the size cap, a bad page address, and signed-out.Deployment
Nothing beyond the standard redeploy (backend only, no migration, no new configuration).
Generated by Claude Code