Fix unsafe gateway media path delivery
This commit is contained in:
committed by
Teknium
parent
4a91e36495
commit
41d2c758c3
@@ -139,7 +139,7 @@ SEND_MESSAGE_SCHEMA = {
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"description": "The message text to send. To send an image or file, include MEDIA:<local_path> (e.g. 'MEDIA:/tmp/hermes/cache/img_xxx.jpg') in the message — the platform will deliver it as a native media attachment."
|
||||
"description": "The message text to send. To send an image or file, include MEDIA:<local_path> for a file under a Hermes media cache or HERMES_MEDIA_ALLOW_DIRS — the platform will deliver it as a native media attachment."
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
@@ -251,6 +251,7 @@ def _handle_send(args):
|
||||
force_document_attachments = "[[as_document]]" in message
|
||||
|
||||
media_files, cleaned_message = BasePlatformAdapter.extract_media(message)
|
||||
media_files = BasePlatformAdapter.filter_media_delivery_paths(media_files)
|
||||
mirror_text = cleaned_message.strip() or _describe_media_for_mirror(media_files)
|
||||
|
||||
used_home_channel = False
|
||||
|
||||
@@ -472,6 +472,7 @@ async def _handle_yb_send_dm(args, **kw):
|
||||
embedded_media, message = BasePlatformAdapter.extract_media(message)
|
||||
if embedded_media:
|
||||
media_files.extend(embedded_media)
|
||||
media_files = BasePlatformAdapter.filter_media_delivery_paths(media_files)
|
||||
|
||||
return tool_result(await send_dm(
|
||||
group_code=group_code, name=args.get("name", ""),
|
||||
|
||||
Reference in New Issue
Block a user