Fix decrypt

This commit is contained in:
shamoon 2024-12-25 09:56:47 -08:00 committed by Sebastian Steinbeißer
parent 4c8a7b9fa6
commit 1ce5a78bc6
No known key found for this signature in database
GPG Key ID: E8200F0F0380C0E0

View File

@ -1,3 +1,5 @@
from pathlib import Path
from django.conf import settings from django.conf import settings
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.core.management.base import CommandError from django.core.management.base import CommandError
@ -67,7 +69,7 @@ class Command(BaseCommand):
document.storage_type = Document.STORAGE_TYPE_UNENCRYPTED document.storage_type = Document.STORAGE_TYPE_UNENCRYPTED
ext: str = document.filename.suffix ext: str = Path(document.filename).suffix
if not ext == ".gpg": if not ext == ".gpg":
raise CommandError( raise CommandError(
@ -75,7 +77,7 @@ class Command(BaseCommand):
f"end with .gpg", f"end with .gpg",
) )
document.filename = document.filename.stem document.filename = Path(document.filename).stem
with document.source_path.open("wb") as f: with document.source_path.open("wb") as f:
f.write(raw_document) f.write(raw_document)