Skip to content

Commit

Permalink
Merge pull request #654 from ArcaniteSolutions/fix-remote-storages-lo…
Browse files Browse the repository at this point in the history
…cation-lookup

Fix non-filesystem storage for Django 5.1
  • Loading branch information
jrief authored Jan 30, 2025
2 parents 9d6fe66 + 2635110 commit 2175969
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 2175969

Please sign in to comment.