mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: media delivery fails for file paths containing spaces (#2621)
Cherry-picked from PR #2583 by Glucksberg. The MEDIA: regex used \S+ which truncated paths at the first space. Added a space-aware alternative anchored to known media extensions. Also updated extract_local_files to allow spaces in path segments. Follow-up fix: changed \s to [^\S\n] in the space-matching group so the regex doesn't greedily match across newlines (broke multi-line MEDIA: tags).
This commit is contained in:
parent
7da0822456
commit
9d6148316c
1 changed files with 1 additions and 1 deletions
|
|
@ -721,7 +721,7 @@ class BasePlatformAdapter(ABC):
|
|||
# Extract MEDIA:<path> tags, allowing optional whitespace after the colon
|
||||
# and quoted/backticked paths for LLM-formatted outputs.
|
||||
media_pattern = re.compile(
|
||||
r'''[`"']?MEDIA:\s*(?P<path>`[^`\n]+`|"[^"\n]+"|'[^'\n]+'|\S+)[`"']?'''
|
||||
r'''[`"']?MEDIA:\s*(?P<path>`[^`\n]+`|"[^"\n]+"|'[^'\n]+'|(?:~/|/)\S+(?:[^\S\n]+\S+)*?\.(?:png|jpe?g|gif|webp|mp4|mov|avi|mkv|webm|ogg|opus|mp3|wav|m4a)(?=[\s`"',;:)\]}]|$)|\S+)[`"']?'''
|
||||
)
|
||||
for match in media_pattern.finditer(content):
|
||||
path = match.group("path").strip()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue