summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-06-29 15:24:50 +0100
committerErik Johnston <erik@matrix.org>2016-06-29 15:24:50 +0100
commitf52cb4cd7893ebf4ec3c793c215b3b5eb8efc232 (patch)
treec09ca640a0e61e65dc5913bf7d6c1b65f4d4de28 /synapse
parentImplement purge_media_cache admin API (diff)
downloadsynapse-f52cb4cd7893ebf4ec3c793c215b3b5eb8efc232.tar.xz
Remove race
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/media/v1/media_repository.py11
1 files changed, 0 insertions, 11 deletions
diff --git a/synapse/rest/media/v1/media_repository.py b/synapse/rest/media/v1/media_repository.py
index 844628c121..692e078419 100644
--- a/synapse/rest/media/v1/media_repository.py
+++ b/synapse/rest/media/v1/media_repository.py
@@ -449,7 +449,6 @@ class MediaRepository(object):
 
             with (yield self.remote_media_linearizer.queue(key)):
                 full_path = self.filepaths.remote_media_filepath(origin, file_id)
-                full_dir = os.path.dirname(full_path)
                 try:
                     os.remove(full_path)
                 except OSError as e:
@@ -459,22 +458,12 @@ class MediaRepository(object):
                     else:
                         continue
 
-                try:
-                    os.removedirs(full_dir)
-                except OSError:
-                    pass
-
                 thumbnail_dir = self.filepaths.remote_media_thumbnail_dir(
                     origin, file_id
                 )
                 shutil.rmtree(thumbnail_dir, ignore_errors=True)
 
                 yield self.store.delete_remote_media(origin, media_id)
-                try:
-                    os.removedirs(thumbnail_dir)
-                except OSError:
-                    pass
-
                 deleted += 1
 
         defer.returnValue({"deleted": deleted})