mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-08 14:18:08 -05:00
override existing content
This commit is contained in:
parent
a24f80c4d0
commit
266b049cfc
@ -950,11 +950,7 @@ class ProxyDaemon:
|
||||
body=await response.transport_response.read(),
|
||||
)
|
||||
|
||||
media_content = media_info.to_content(content["url"],
|
||||
upload_info.filename,
|
||||
content_msgtype,
|
||||
upload_info.mimetype
|
||||
),
|
||||
media_content = media_info.to_content(content, upload_info.mimetype)
|
||||
|
||||
response = await client.room_send(
|
||||
room_id, msgtype, media_content, txnid, ignore_unverified
|
||||
|
@ -48,26 +48,16 @@ class MediaInfo:
|
||||
iv = attr.ib(type=str)
|
||||
hashes = attr.ib(type=dict)
|
||||
|
||||
def to_content(self, url: str, file_name: str, msgtype: str, mime_type: str) -> Dict[Any, Any]:
|
||||
content = {
|
||||
"file": {
|
||||
def to_content(self, content: Dict, mime_type: str) -> Dict[Any, Any]:
|
||||
content["file"] = {
|
||||
"v": "v2",
|
||||
"key": self.key,
|
||||
"iv": self.iv,
|
||||
"hashes": self.hashes,
|
||||
"url": url,
|
||||
"url": content["url"],
|
||||
"mimetype": mime_type,
|
||||
}
|
||||
}
|
||||
|
||||
if len(file_name) > 0:
|
||||
content["body"] = file_name
|
||||
else:
|
||||
content["body"] = url
|
||||
|
||||
if msgtype:
|
||||
content["msgtype"] = msgtype
|
||||
|
||||
return content
|
||||
|
||||
@attr.s
|
||||
|
Loading…
Reference in New Issue
Block a user