Revert "fix remote thumbnails?"

This has now been fixed by a different commit (73d93039f).

This reverts commit b0a463f758.
This commit is contained in:
Richard van der Hoff 2020-10-02 12:30:49 +01:00
parent b0a463f758
commit 5ccc0785c1

View file

@ -143,9 +143,12 @@ class MediaStorage:
"""
path = self._file_info_to_path(file_info)
local_path = os.path.join(self.local_media_directory, path)
if os.path.exists(local_path):
return FileResponder(open(local_path, "rb"))
# fallback for remote thumbnails with no method in the filename
legacy_path = None
# Fallback for paths without method names
# Should be removed in the future
if file_info.thumbnail and file_info.server_name:
legacy_path = self.filepaths.remote_media_thumbnail_rel_legacy(
server_name=file_info.server_name,
@ -154,19 +157,8 @@ class MediaStorage:
height=file_info.thumbnail_height,
content_type=file_info.thumbnail_type,
)
local_path = os.path.join(self.local_media_directory, path)
if os.path.exists(local_path):
logger.debug("responding with local file %s", local_path)
return FileResponder(open(local_path, "rb"))
if legacy_path:
logger.debug(
"local file %s did not exist; checking legacy name", local_path
)
legacy_local_path = os.path.join(self.local_media_directory, legacy_path)
if os.path.exists(legacy_local_path):
logger.debug("responding with local file %s", legacy_local_path)
return FileResponder(open(legacy_local_path, "rb"))
for provider in self.storage_providers:
@ -174,14 +166,6 @@ class MediaStorage:
if res:
logger.debug("Streaming %s from %s", path, provider)
return res
if legacy_path:
logger.debug(
"Provider %s did not find %s; checking legacy name", provider, path
)
res = await provider.fetch(legacy_path, file_info)
if res:
logger.debug("Streaming %s from %s", legacy_path, provider)
return res
return None