diff --git a/src-ui/src/app/data/paperless-document-metadata.ts b/src-ui/src/app/data/paperless-document-metadata.ts index 1f9155b3a..152f69046 100644 --- a/src-ui/src/app/data/paperless-document-metadata.ts +++ b/src-ui/src/app/data/paperless-document-metadata.ts @@ -7,5 +7,7 @@ export interface PaperlessDocumentMetadata { media_filename?: string + original_filename?: string + has_archive_version?: boolean } diff --git a/src/documents/admin.py b/src/documents/admin.py index 3e3f1eb1c..6fa06c49b 100644 --- a/src/documents/admin.py +++ b/src/documents/admin.py @@ -42,6 +42,7 @@ class DocumentAdmin(admin.ModelAdmin): "checksum", "archive_filename", "archive_checksum", + "original_filename", ) list_display_links = ("title",) diff --git a/src/documents/consumer.py b/src/documents/consumer.py index 69a9efb48..bbad88b12 100644 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -475,6 +475,7 @@ class Consumer(LoggingMixin): created=create_date, modified=create_date, storage_type=storage_type, + original_filename=self.filename ) self.apply_overrides(document) diff --git a/src/documents/models.py b/src/documents/models.py index d8e02e570..af96104e0 100644 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -214,6 +214,16 @@ class Document(models.Model): help_text=_("Current archive filename in storage"), ) + original_filename = models.FilePathField( + _("original filename"), + max_length=1024, + editable=False, + default=None, + unique=False, + null=True, + help_text=_("The original name of the file when it was uploaded") + ) + archive_serial_number = models.IntegerField( _("archive serial number"), blank=True, diff --git a/src/documents/views.py b/src/documents/views.py index 84fc38a38..b261f37fd 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -313,6 +313,7 @@ class DocumentViewSet( "original_metadata": self.get_metadata(doc.source_path, doc.mime_type), "archive_checksum": doc.archive_checksum, "archive_media_filename": doc.archive_filename, + "original_filename": doc.original_filename, } if doc.has_archive_version: