mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 14:24:58 -04:00
Avoid storing URL cache files in storage providers (#10911)
URL cache files are short-lived and it does not make sense to offload them (eg. to the cloud) or back them up.
This commit is contained in:
parent
6c83c27107
commit
f7768f62cb
6 changed files with 154 additions and 6 deletions
|
@ -195,23 +195,24 @@ class MediaFilePaths:
|
|||
|
||||
url_cache_thumbnail = _wrap_in_base_path(url_cache_thumbnail_rel)
|
||||
|
||||
def url_cache_thumbnail_directory(self, media_id: str) -> str:
|
||||
def url_cache_thumbnail_directory_rel(self, media_id: str) -> str:
|
||||
# Media id is of the form <DATE><RANDOM_STRING>
|
||||
# E.g.: 2017-09-28-fsdRDt24DS234dsf
|
||||
|
||||
if NEW_FORMAT_ID_RE.match(media_id):
|
||||
return os.path.join(
|
||||
self.base_path, "url_cache_thumbnails", media_id[:10], media_id[11:]
|
||||
)
|
||||
return os.path.join("url_cache_thumbnails", media_id[:10], media_id[11:])
|
||||
else:
|
||||
return os.path.join(
|
||||
self.base_path,
|
||||
"url_cache_thumbnails",
|
||||
media_id[0:2],
|
||||
media_id[2:4],
|
||||
media_id[4:],
|
||||
)
|
||||
|
||||
url_cache_thumbnail_directory = _wrap_in_base_path(
|
||||
url_cache_thumbnail_directory_rel
|
||||
)
|
||||
|
||||
def url_cache_thumbnail_dirs_to_delete(self, media_id: str) -> List[str]:
|
||||
"The dirs to try and remove if we delete the media_id thumbnails"
|
||||
# Media id is of the form <DATE><RANDOM_STRING>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue