From 26351108ed706721492e606fe4ff51179d8a4844 Mon Sep 17 00:00:00 2001 From: Damien Fiorucci Date: Thu, 5 Sep 2024 12:53:38 +0200 Subject: [PATCH] check storage has location before fixing path --- easy_thumbnails/files.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/easy_thumbnails/files.py b/easy_thumbnails/files.py index 5e6cd89..8e0ee56 100644 --- a/easy_thumbnails/files.py +++ b/easy_thumbnails/files.py @@ -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()