mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
fixes #112
This commit is contained in:
parent
8ca97924be
commit
6003122b06
@ -248,7 +248,7 @@ class Consumer(LoggingMixin):
|
|||||||
with open(self.path, "rb") as f:
|
with open(self.path, "rb") as f:
|
||||||
document = Document.objects.create(
|
document = Document.objects.create(
|
||||||
correspondent=file_info.correspondent,
|
correspondent=file_info.correspondent,
|
||||||
title=file_info.title,
|
title=(self.override_title or file_info.title)[:127],
|
||||||
content=text,
|
content=text,
|
||||||
mime_type=mime_type,
|
mime_type=mime_type,
|
||||||
checksum=hashlib.md5(f.read()).hexdigest(),
|
checksum=hashlib.md5(f.read()).hexdigest(),
|
||||||
@ -265,12 +265,11 @@ class Consumer(LoggingMixin):
|
|||||||
|
|
||||||
self.apply_overrides(document)
|
self.apply_overrides(document)
|
||||||
|
|
||||||
|
document.save()
|
||||||
|
|
||||||
return document
|
return document
|
||||||
|
|
||||||
def apply_overrides(self, document):
|
def apply_overrides(self, document):
|
||||||
if self.override_title:
|
|
||||||
document.title = self.override_title
|
|
||||||
|
|
||||||
if self.override_correspondent_id:
|
if self.override_correspondent_id:
|
||||||
document.correspondent = Correspondent.objects.get(
|
document.correspondent = Correspondent.objects.get(
|
||||||
pk=self.override_correspondent_id)
|
pk=self.override_correspondent_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user