summaryrefslogtreecommitdiff
path: root/django/contrib/staticfiles/storage.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/contrib/staticfiles/storage.py')
-rw-r--r--django/contrib/staticfiles/storage.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py
index 5c0f4892da..371e9f2755 100644
--- a/django/contrib/staticfiles/storage.py
+++ b/django/contrib/staticfiles/storage.py
@@ -86,8 +86,8 @@ class HashedFilesMixin:
parsed_name = urlsplit(unquote(name))
clean_name = parsed_name.path.strip()
filename = (filename and urlsplit(unquote(filename)).path.strip()) or clean_name
- opened = False
- if content is None:
+ opened = content is None
+ if opened:
if not self.exists(filename):
raise ValueError("The file '%s' could not be found with %r." % (filename, self))
try:
@@ -95,7 +95,6 @@ class HashedFilesMixin:
except IOError:
# Handle directory paths and fragments
return name
- opened = True
try:
file_hash = self.file_hash(clean_name, content)
finally: