Skip to content

Commit

Permalink
fix: provide fallback for THUMBNAILS_DIR_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
jerivas committed Sep 22, 2021
1 parent e50e41a commit f9991d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion filebrowser_safe/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ def remove_thumbnails(file_path):
"""
from django.conf import settings

thumb_dir = getattr(settings, "THUMBNAILS_DIR_NAME", ".thumbnails")
dir_name, file_name = os.path.split(file_path)
path = os.path.join(dir_name, settings.THUMBNAILS_DIR_NAME, file_name)
path = os.path.join(dir_name, thumb_dir, file_name)
try:
default_storage.rmtree(path)
except: # noqa
Expand Down
3 changes: 0 additions & 3 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,3 @@
},
},
]

# Non standart settings
THUMBNAILS_DIR_NAME = "thumbnails"

0 comments on commit f9991d5

Please sign in to comment.