mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
Creates a data model for the document consumption, allowing stronger typing of arguments and setting of some information about the file only once
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from celery import states
|
||||
from celery.signals import before_task_publish
|
||||
@@ -533,17 +532,9 @@ def before_task_publish_handler(sender=None, headers=None, body=None, **kwargs):
|
||||
|
||||
try:
|
||||
task_args = body[0]
|
||||
task_kwargs = body[1]
|
||||
input_doc, _ = task_args
|
||||
|
||||
task_file_name = ""
|
||||
if "override_filename" in task_kwargs:
|
||||
task_file_name = task_kwargs["override_filename"]
|
||||
|
||||
# Nothing was found, report the task first argument
|
||||
if not len(task_file_name):
|
||||
# There are always some arguments to the consume, first is always filename
|
||||
filepath = Path(task_args[0])
|
||||
task_file_name = filepath.name
|
||||
task_file_name = input_doc.original_file.name
|
||||
|
||||
PaperlessTask.objects.create(
|
||||
task_id=headers["id"],
|
||||
|
Reference in New Issue
Block a user