mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-09 09:58:20 -05:00
path sanitation
This commit is contained in:
parent
5894060dc5
commit
31bea6a361
@ -99,6 +99,11 @@ def generate_filename(doc, counter=0):
|
|||||||
tags = defaultdictNoStr(lambda: slugify(None),
|
tags = defaultdictNoStr(lambda: slugify(None),
|
||||||
many_to_dictionary(doc.tags))
|
many_to_dictionary(doc.tags))
|
||||||
|
|
||||||
|
tag_list = pathvalidate.sanitize_filename(
|
||||||
|
",".join([tag.name for tag in doc.tags.all()]),
|
||||||
|
replacement_text="-"
|
||||||
|
)
|
||||||
|
|
||||||
if doc.correspondent:
|
if doc.correspondent:
|
||||||
correspondent = pathvalidate.sanitize_filename(
|
correspondent = pathvalidate.sanitize_filename(
|
||||||
doc.correspondent.name, replacement_text="-"
|
doc.correspondent.name, replacement_text="-"
|
||||||
@ -127,7 +132,7 @@ def generate_filename(doc, counter=0):
|
|||||||
added_month=f"{doc.added.month:02}" if doc.added else "none",
|
added_month=f"{doc.added.month:02}" if doc.added else "none",
|
||||||
added_day=f"{doc.added.day:02}" if doc.added else "none",
|
added_day=f"{doc.added.day:02}" if doc.added else "none",
|
||||||
tags=tags,
|
tags=tags,
|
||||||
tag_list=",".join([tag.name for tag in doc.tags.all()])
|
tag_list=tag_list
|
||||||
).strip()
|
).strip()
|
||||||
|
|
||||||
path = path.strip(os.sep)
|
path = path.strip(os.sep)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user