From 1ce5a78bc670b0f9ff00835cc985f3ea9c8a5df7 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 25 Dec 2024 09:56:47 -0800 Subject: [PATCH] Fix decrypt --- src/documents/management/commands/decrypt_documents.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/documents/management/commands/decrypt_documents.py b/src/documents/management/commands/decrypt_documents.py index 4dda725d0..aa8e7d184 100644 --- a/src/documents/management/commands/decrypt_documents.py +++ b/src/documents/management/commands/decrypt_documents.py @@ -1,3 +1,5 @@ +from pathlib import Path + from django.conf import settings from django.core.management.base import BaseCommand from django.core.management.base import CommandError @@ -67,7 +69,7 @@ class Command(BaseCommand): document.storage_type = Document.STORAGE_TYPE_UNENCRYPTED - ext: str = document.filename.suffix + ext: str = Path(document.filename).suffix if not ext == ".gpg": raise CommandError( @@ -75,7 +77,7 @@ class Command(BaseCommand): f"end with .gpg", ) - document.filename = document.filename.stem + document.filename = Path(document.filename).stem with document.source_path.open("wb") as f: f.write(raw_document)