mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-21 03:42:55 +03:00
Log which files we saved attachments to in the media_repository
This commit is contained in:
parent
1d08de6ce9
commit
69ef497253
3 changed files with 11 additions and 0 deletions
|
@ -98,6 +98,8 @@ class MediaRepository(object):
|
||||||
with open(fname, "wb") as f:
|
with open(fname, "wb") as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
||||||
|
logger.info("Stored local media in file %r", fname)
|
||||||
|
|
||||||
yield self.store.store_local_media(
|
yield self.store.store_local_media(
|
||||||
media_id=media_id,
|
media_id=media_id,
|
||||||
media_type=media_type,
|
media_type=media_type,
|
||||||
|
@ -190,6 +192,8 @@ class MediaRepository(object):
|
||||||
else:
|
else:
|
||||||
upload_name = None
|
upload_name = None
|
||||||
|
|
||||||
|
logger.info("Stored remote media in file %r", fname)
|
||||||
|
|
||||||
yield self.store.store_cached_remote_media(
|
yield self.store.store_cached_remote_media(
|
||||||
origin=server_name,
|
origin=server_name,
|
||||||
media_id=media_id,
|
media_id=media_id,
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
import PIL.Image as Image
|
import PIL.Image as Image
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Thumbnailer(object):
|
class Thumbnailer(object):
|
||||||
|
|
||||||
|
@ -86,4 +90,5 @@ class Thumbnailer(object):
|
||||||
output_bytes = output_bytes_io.getvalue()
|
output_bytes = output_bytes_io.getvalue()
|
||||||
with open(output_path, "wb") as output_file:
|
with open(output_path, "wb") as output_file:
|
||||||
output_file.write(output_bytes)
|
output_file.write(output_bytes)
|
||||||
|
logger.info("Stored thumbnail in file %r", output_path)
|
||||||
return len(output_bytes)
|
return len(output_bytes)
|
||||||
|
|
|
@ -97,6 +97,8 @@ class UploadResource(Resource):
|
||||||
content_length, requester.user
|
content_length, requester.user
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logger.info("Uploaded content with URI %r", content_uri)
|
||||||
|
|
||||||
respond_with_json(
|
respond_with_json(
|
||||||
request, 200, {"content_uri": content_uri}, send_cors=True
|
request, 200, {"content_uri": content_uri}, send_cors=True
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue