From f5eb4c307bfdbfa5f24c5bff59881295f17b17ac Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Tue, 30 Jun 2026 03:10:02 -0700 Subject: [PATCH] fix(gateway): stop Matrix upload fallback from leaking host path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- plugins/platforms/matrix/adapter.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/platforms/matrix/adapter.py b/plugins/platforms/matrix/adapter.py index 7cc4cd8aec4..0b663f1b775 100644 --- a/plugins/platforms/matrix/adapter.py +++ b/plugins/platforms/matrix/adapter.py @@ -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: