mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-01 12:02:05 +00:00
fix(gateway): stop Matrix upload fallback from leaking host path
The Matrix adapter's _upload_file fell back to sending
"(file not found: {file_path})" directly into the room — the same
host-path leak class fixed for the base adapter and Slack in the
previous commit. Replace it with a friendly notice, log the path at
WARN for operators, and preserve any caller-supplied caption.
This commit is contained in:
parent
cb9d18c759
commit
f5eb4c307b
1 changed files with 7 additions and 2 deletions
|
|
@ -2149,9 +2149,14 @@ class MatrixAdapter(BasePlatformAdapter):
|
|||
"""Read a local file and upload it."""
|
||||
p = Path(file_path).expanduser()
|
||||
if not p.exists():
|
||||
return await self.send(
|
||||
room_id, f"{caption or ''}\n(file not found: {file_path})", reply_to
|
||||
# file_path is a host-local path; never echo it into chat.
|
||||
logger.warning(
|
||||
"[%s] upload fallback: media file not found for %s",
|
||||
self.name, file_path,
|
||||
)
|
||||
text = f"{caption}\n⚠️ Couldn't deliver the attachment." if caption \
|
||||
else "⚠️ Couldn't deliver the attachment."
|
||||
return await self.send(room_id, text, reply_to)
|
||||
try:
|
||||
file_size = p.stat().st_size
|
||||
except OSError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue