mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-22 21:31:04 -05:00
store filename in upload info
This commit is contained in:
parent
b6b4362ade
commit
6cedf846bd
@ -837,7 +837,7 @@ class ProxyDaemon:
|
||||
except KeyError:
|
||||
upload_info = self.store.load_upload(self.name, content_uri)
|
||||
if not upload_info:
|
||||
return None, None, None
|
||||
return None, None
|
||||
|
||||
self.upload_info[content_uri] = upload_info
|
||||
|
||||
@ -848,7 +848,7 @@ class ProxyDaemon:
|
||||
|
||||
media_info = self.store.load_media(self.name, mxc_server, mxc_path)
|
||||
if not media_info:
|
||||
return None, None, None
|
||||
return None, None
|
||||
|
||||
self.media_info[(mxc_server, mxc_path)] = media_info
|
||||
|
||||
@ -1159,7 +1159,7 @@ class ProxyDaemon:
|
||||
body=await response.transport_response.read(),
|
||||
)
|
||||
|
||||
self.store.save_upload(self.name, response.content_uri, content_type)
|
||||
self.store.save_upload(self.name, response.content_uri, file_name, content_type)
|
||||
|
||||
mxc = urlparse(response.content_uri)
|
||||
mxc_server = mxc.netloc.strip("/")
|
||||
|
@ -201,12 +201,13 @@ class PanStore:
|
||||
return None
|
||||
|
||||
@use_database
|
||||
def save_upload(self, server, content_uri, mimetype):
|
||||
def save_upload(self, server, content_uri, filename, mimetype):
|
||||
server = Servers.get(name=server)
|
||||
|
||||
PanUploadInfo.insert(
|
||||
server=server,
|
||||
content_uri=content_uri,
|
||||
filename=filename,
|
||||
mimetype=mimetype,
|
||||
).on_conflict_ignore().execute()
|
||||
|
||||
|
@ -191,7 +191,7 @@ class TestClass(object):
|
||||
|
||||
upload = UploadInfo(event.url, filename, mimetype)
|
||||
|
||||
panstore.save_upload(server_name, event.url, mimetype)
|
||||
panstore.save_upload(server_name, event.url, filename, mimetype)
|
||||
|
||||
upload_cache = panstore.load_upload(server_name)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user