Skip to content

Commit

Permalink
check storage has location before fixing path
Browse files Browse the repository at this point in the history
  • Loading branch information
dfarcanite authored and steven-jeanneret committed Nov 27, 2024
1 parent 9d6fe66 commit 2635110
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions easy_thumbnails/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,9 @@ def get_thumbnail_name(self, thumbnail_options, transparent=False):
"""
thumbnail_options = self.get_options(thumbnail_options)
path, source_filename = os.path.split(self.name)
# remove storage location
path = path.replace(self.source_storage.location, '')
if hasattr(self.source_storage, 'location'): # remote storages do not have the location attribute
# remove storage location
path = path.replace(self.source_storage.location, '')
# remove leading slash if present
path = path.lstrip('/')
source_extension = os.path.splitext(source_filename)[1][1:].lower()
Expand Down

0 comments on commit 2635110

Please sign in to comment.