mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-10 16:46:50 +01:00
Removed try-catch around os.makedirs and used exist_ok=True instead
This commit is contained in:
parent
26b20cf62e
commit
e79f5394fc
1 changed files with 2 additions and 6 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue