11from math import ceil
22
33from django .contrib .staticfiles .storage import staticfiles_storage
4- from django .core .files .storage import FileSystemStorage , default_storage
4+ from django .core .files .storage import FileSystemStorage
55from django .template import Library
66from django .templatetags .static import static
77from django .urls import reverse
@@ -109,7 +109,7 @@ def file_icon_context(file, detail, width, height):
109109 'height' : width , # The icon is a square
110110 }
111111 # Check if file exists for performance reasons (only on FileSystemStorage)
112- if isinstance ( default_storage , FileSystemStorage ) and file .file and not file .file .exists ():
112+ if file . file and isinstance ( file .file . source_storage , FileSystemStorage ) and not file .file .exists ():
113113 return not_available_context
114114
115115 if isinstance (file , BaseImage ):
@@ -131,9 +131,9 @@ def file_icon_context(file, detail, width, height):
131131 configured_name = thumbnailer .get_thumbnail_name (thumbnail_options , transparent = file ._transparent )
132132 # If the name was annotated: Thumbnail exists and we can use it
133133 if configured_name == file .thumbnail_name :
134- icon_url = default_storage .url (configured_name )
134+ icon_url = file . file . thumbnail_storage .url (configured_name )
135135 if mime_subtype != 'svg+xml' and file .thumbnailx2_name :
136- context ['highres_url' ] = default_storage .url (file .thumbnailx2_name )
136+ context ['highres_url' ] = file . file . thumbnail_storage .url (file .thumbnailx2_name )
137137 else : # Probably does not exist, defer creation
138138 icon_url = reverse ("admin:filer_file_fileicon" , args = (file .pk , width ))
139139 context ['alt_text' ] = file .default_alt_text
0 commit comments