Files
hermes-agent/gateway/relay
Victor Kyriazakos 25a61a6e87 fix(relay): keep original attachment filenames for the agent
Relay inbound attachments are localized to random relay_media_<x> temp
files, and that random basename was the only name left. The wire
media[].filename was dropped, Content-Disposition only contributed its
extension, and the document note showed the random basename as the
user's filename.

- MessageEvent.media_filenames: per-attachment original name, parallel
  to media_urls with the same invariant as media_types ("" = unknown).
- _event_from_wire fills it from media[].filename by URL lookup. Older
  connector payloads without the field still parse.
- RelayMediaClient.download_with_name returns (path, name). It prefers
  suggested_name, then Content-Disposition parsed with the stdlib MIME
  parser (quoted values, RFC 5987 filename* preferred over filename).
  download() keeps its path-only signature. Storage stays a random temp
  name, so duplicate names never collide.
- _localize_inbound_media carries (url, mime, name) triples, so a failed
  download never shifts a neighbour's type or name.
- Document, audio and video notes use the original name when known. A
  relay temp file with no known name is labelled
  "(original filename unknown)" instead of its random basename. Native
  cache paths (doc_<id>_<name>) render exactly as before.
- Names are untrusted: basename only, control/format characters
  dropped, 255-char cap, and the existing note regex replaces quotes
  and brackets.
- The names survive pending-message merges, text batching, /queue and
  the native admission envelope. The envelope omits the field when no
  name is known, so existing admissions keep their fingerprint.
2026-10-28 19:49:37 -07:00
..
2026-10-09 17:34:38 +02:00