Skip to content

Commit 859857c

Browse files
authored
Merge pull request #547 from julianwachholz/fix/content-seekable
Fix: only seek files when possible
2 parents c13b348 + 7b56b2a commit 859857c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

imagekit/cachefiles/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ def _generate(self):
102102
actual_name = self.storage.save(self.name, content)
103103

104104
# We're going to reuse the generated file, so we need to reset the pointer.
105-
content.seek(0)
105+
if not hasattr(content, "seekable") or content.seekable():
106+
content.seek(0)
106107

107108
# Store the generated file. If we don't do this, the next time the
108109
# "file" attribute is accessed, it will result in a call to the storage

0 commit comments

Comments
 (0)