diff --git a/gateway/platforms/base.py b/gateway/platforms/base.py index 6979a869148..e1b677f12a1 100644 --- a/gateway/platforms/base.py +++ b/gateway/platforms/base.py @@ -1191,10 +1191,12 @@ _MEDIA_EXT_ALTERNATION = "|".join( # bare-path detector (extract_local_files) downstream rather than silently # deleted. Shared by the non-streaming dispatch path and the streaming # consumer so both behave identically. +# Path anchors: ``~/`` (Unix home-relative), ``/`` (Unix absolute), +# ``X:\\`` or ``X:/`` (Windows drive-letter absolute — #34632). MEDIA_TAG_CLEANUP_RE = re.compile( r'''[`"']?MEDIA:\s*''' r'''(?P`[^`\n]+`|"[^"\n]+"|'[^'\n]+'|''' - r'''(?:~/|/)\S+(?:[^\S\n]+\S+)*?\.(?:''' + _MEDIA_EXT_ALTERNATION + r'''))''' + r'''(?:~/|/|[A-Za-z]:[/\\])\S+(?:[^\S\n]+\S+)*?\.(?:''' + _MEDIA_EXT_ALTERNATION + r'''))''' r'''(?=[\s`"',;:)\]}]|$)[`"']?''', re.IGNORECASE, ) @@ -2665,9 +2667,10 @@ class BasePlatformAdapter(ABC): # (?