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