MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / _stories_tables_init

Function _stories_tables_init

Scripts/ButSystem.py:18506–18525  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18504 conn = db_connect()
18505 row = conn.execute(
18506 "SELECT a.id, a.filename_enc, a.mime_enc, a.stored_path, a.report_id FROM report_attachments a JOIN reports r ON r.id=a.report_id WHERE a.id=?",
18507 (aid,),
18508 ).fetchone()
18509 conn.close()
18510 safe_path = _safe_report_att_path(row["stored_path"]) if row else None
18511 if not row or not safe_path:
18512 abort(404)
18513 try:
18514 filename = aesgcm_decrypt_text(row["filename_enc"])
18515 except Exception:
18516 filename = "attachment"
18517 try:
18518 mime = aesgcm_decrypt_text(row["mime_enc"])
18519 except Exception:
18520 mime = "application/octet-stream"
18521 filename = secure_filename(filename or "attachment") or "attachment"
18522 resp = send_file(safe_path, mimetype=mime, as_attachment=True, download_name=filename, conditional=True, max_age=0)
18523 resp.headers["Cache-Control"] = "no-store"
18524 resp.headers["X-Download-Options"] = "noopen"
18525 return resp
18526
18527
18528_DISCUSS_ROW_TEMPLATE = r"""

Callers 8

_story_active_usernamesFunction · 0.70
_story_user_cardsFunction · 0.70
_stories_for_userFunction · 0.70
storiesFunction · 0.70
story_uploadFunction · 0.70
story_view_userFunction · 0.70
story_reactFunction · 0.70
story_mediaFunction · 0.70

Calls 1

db_connectFunction · 0.70

Tested by

no test coverage detected