Skip to content

Commit edbfb33

Browse files
committed
Change Compressor.read_bytes to open local files found via static files finders
1 parent a12407e commit edbfb33

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pipeline/compressors/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from itertools import takewhile
99

10+
from django.contrib.staticfiles import finders
1011
from django.contrib.staticfiles.storage import staticfiles_storage
1112
from django.utils.encoding import smart_bytes, force_text
1213

@@ -207,7 +208,12 @@ def relative_path(self, absolute_path, output_filename):
207208

208209
def read_bytes(self, path):
209210
"""Read file content in binary mode"""
210-
file = staticfiles_storage.open(path)
211+
finder_path = finders.find(path)
212+
if finder_path is not None:
213+
file = open(finder_path)
214+
else:
215+
raise Exception("File '%s' not found via "
216+
"static files finders", path)
211217
content = file.read()
212218
file.close()
213219
return content

0 commit comments

Comments
 (0)