MCPcopy Create free account
hub / github.com/CScorza/IntelOSINT / api_media_download

Function api_media_download

IntelOSINT.py:21640–21654  ·  view source on GitHub ↗
(media_id)

Source from the content-addressed store, hash-verified

21638
21639@app.route('/api/media/download/<media_id>', methods=['GET'])
21640def api_media_download(media_id):
21641 denied = require_authenticated_download("media_download", limit=80, window=60)
21642 if denied:
21643 return denied
21644 entry = MEDIA_EXPORTS.get(media_id)
21645 if not entry:
21646 return "File non trovato", 404
21647 p = entry.get("path")
21648 n = entry.get("name") or Path(p).name
21649 if not p or not Path(p).exists():
21650 return "File non disponibile", 404
21651 inline = str(request.args.get("inline", "")).strip().lower() in {"1", "true", "yes", "on"}
21652 ext = Path(p).suffix.lower()
21653 mime = "application/pdf" if media_id.endswith("-report") or ext == ".pdf" else None
21654 return send_file(p, as_attachment=not inline, download_name=n, mimetype=mime)
21655
21656@app.route('/api/media/frame/<media_id>/<frame_name>', methods=['GET'])
21657def api_media_frame(media_id, frame_name):

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected