Skip to content

Commit 3f237d8

Browse files
authored
Merge pull request #1 from CreditEngine/feature/fix-disable-export-db-to-fs
🐛 Fixed an error when deleting a file if file output to the file system is disabled and the user does not have write permission to the file system.
2 parents 96a7457 + dcc1f28 commit 3f237d8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

binary_database_files/storage.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,10 @@ def delete(self, name):
142142
name = self.get_instance_name(name)
143143
try:
144144
models.File.objects.get_from_name(name).delete()
145-
hash_fn = utils.get_hash_fn(name)
146-
if os.path.isfile(hash_fn):
147-
os.remove(hash_fn)
145+
if _settings.DB_FILES_AUTO_EXPORT_DB_TO_FS:
146+
hash_fn = utils.get_hash_fn(name)
147+
if os.path.isfile(hash_fn):
148+
os.remove(hash_fn)
148149
except models.File.DoesNotExist:
149150
pass
150151
localpath = self._path(name)

0 commit comments

Comments
 (0)