forked from MirrorHub/synapse
Correctly use server_name/file_id when generating/fetching remote thumbnails
This commit is contained in:
parent
c5b589f2e8
commit
9795b9ebb1
2 changed files with 8 additions and 5 deletions
|
@ -539,7 +539,10 @@ class MediaRepository(object):
|
||||||
Deferred[dict]: Dict with "width" and "height" keys of original image
|
Deferred[dict]: Dict with "width" and "height" keys of original image
|
||||||
"""
|
"""
|
||||||
media_type = media_info["media_type"]
|
media_type = media_info["media_type"]
|
||||||
file_id = media_info.get("filesystem_id")
|
if server_name:
|
||||||
|
file_id = media_info["filesystem_id"]
|
||||||
|
else:
|
||||||
|
file_id = media_id
|
||||||
requirements = self._get_thumbnail_requirements(media_type)
|
requirements = self._get_thumbnail_requirements(media_type)
|
||||||
if not requirements:
|
if not requirements:
|
||||||
return
|
return
|
||||||
|
@ -597,7 +600,7 @@ class MediaRepository(object):
|
||||||
try:
|
try:
|
||||||
file_info = FileInfo(
|
file_info = FileInfo(
|
||||||
server_name=server_name,
|
server_name=server_name,
|
||||||
file_id=media_id,
|
file_id=file_id,
|
||||||
thumbnail=True,
|
thumbnail=True,
|
||||||
thumbnail_width=t_width,
|
thumbnail_width=t_width,
|
||||||
thumbnail_height=t_height,
|
thumbnail_height=t_height,
|
||||||
|
|
|
@ -185,7 +185,7 @@ class ThumbnailResource(Resource):
|
||||||
|
|
||||||
if t_w and t_h and t_method and t_type:
|
if t_w and t_h and t_method and t_type:
|
||||||
file_info = FileInfo(
|
file_info = FileInfo(
|
||||||
server_name=None, file_id=media_id,
|
server_name=server_name, file_id=media_info["filesystem_id"],
|
||||||
thumbnail=True,
|
thumbnail=True,
|
||||||
thumbnail_width=info["thumbnail_width"],
|
thumbnail_width=info["thumbnail_width"],
|
||||||
thumbnail_height=info["thumbnail_height"],
|
thumbnail_height=info["thumbnail_height"],
|
||||||
|
@ -221,7 +221,7 @@ class ThumbnailResource(Resource):
|
||||||
# TODO: Don't download the whole remote file
|
# TODO: Don't download the whole remote file
|
||||||
# We should proxy the thumbnail from the remote server instead of
|
# We should proxy the thumbnail from the remote server instead of
|
||||||
# downloading the remote file and generating our own thumbnails.
|
# downloading the remote file and generating our own thumbnails.
|
||||||
yield self.media_repo.get_remote_media_info(server_name, media_id)
|
media_info = yield self.media_repo.get_remote_media_info(server_name, media_id)
|
||||||
|
|
||||||
thumbnail_infos = yield self.store.get_remote_media_thumbnails(
|
thumbnail_infos = yield self.store.get_remote_media_thumbnails(
|
||||||
server_name, media_id,
|
server_name, media_id,
|
||||||
|
@ -232,7 +232,7 @@ class ThumbnailResource(Resource):
|
||||||
width, height, method, m_type, thumbnail_infos
|
width, height, method, m_type, thumbnail_infos
|
||||||
)
|
)
|
||||||
file_info = FileInfo(
|
file_info = FileInfo(
|
||||||
server_name=None, file_id=media_id,
|
server_name=server_name, file_id=media_info["filesystem_id"],
|
||||||
thumbnail=True,
|
thumbnail=True,
|
||||||
thumbnail_width=thumbnail_info["thumbnail_width"],
|
thumbnail_width=thumbnail_info["thumbnail_width"],
|
||||||
thumbnail_height=thumbnail_info["thumbnail_height"],
|
thumbnail_height=thumbnail_info["thumbnail_height"],
|
||||||
|
|
Loading…
Reference in a new issue