mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-06 14:55:07 +01:00
Cleaned up file_name()
This commit is contained in:
parent
a892abc701
commit
39134b517e
1 changed files with 1 additions and 7 deletions
|
|
@ -2,7 +2,6 @@ import datetime
|
||||||
import email
|
import email
|
||||||
import imaplib
|
import imaplib
|
||||||
import os
|
import os
|
||||||
import random
|
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
@ -93,12 +92,7 @@ class Message(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def file_name(self):
|
def file_name(self):
|
||||||
|
return "{}.{}".format(self.subject, self.attachment.suffix)
|
||||||
prefix = str(random.randint(100000, 999999))
|
|
||||||
if self.SAFE_SUBJECT_REGEX.match(self.subject):
|
|
||||||
prefix = self.subject
|
|
||||||
|
|
||||||
return "{}.{}".format(prefix, self.attachment.suffix)
|
|
||||||
|
|
||||||
|
|
||||||
class Attachment(object):
|
class Attachment(object):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue