mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Removed try-catch around os.makedirs and used exist_ok=True instead
This commit is contained in:
parent
26b20cf62e
commit
e79f5394fc
@ -335,13 +335,9 @@ class Document(models.Model):
|
|||||||
if self.storage_type == self.STORAGE_TYPE_GPG:
|
if self.storage_type == self.STORAGE_TYPE_GPG:
|
||||||
filename += ".gpg"
|
filename += ".gpg"
|
||||||
|
|
||||||
# Create directory for target
|
# Create directory for target (and ignore, if directory exists already)
|
||||||
create_dir = self.filename_to_path(slugify(directory))
|
create_dir = self.filename_to_path(slugify(directory))
|
||||||
try:
|
os.makedirs(create_dir, exist_ok=True)
|
||||||
os.makedirs(create_dir)
|
|
||||||
except os.error:
|
|
||||||
# Directory existed already, ignore
|
|
||||||
pass
|
|
||||||
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user