From 7ce5a0a5fb309604e72de18c9315290361b72370 Mon Sep 17 00:00:00 2001 From: MachinePainting Date: Sun, 22 Feb 2026 21:13:57 -0800 Subject: [PATCH] Fix encryption to preserve original file extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Encryption now appends .enc to the full filename instead of replacing the extension. This preserves the file format through the encrypt/decrypt round-trip (e.g., image.png → image.png.enc → image.png). --- encrypt_file.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/encrypt_file.py b/encrypt_file.py index 7966c45..cf3b1bb 100644 --- a/encrypt_file.py +++ b/encrypt_file.py @@ -104,8 +104,7 @@ class FileEncryptHandler(FileSystemEventHandler): file_data = f.read() encrypted_data = fernet.encrypt(file_data) - base_name = os.path.splitext(file_path)[0] - enc_path = base_name + '.enc' + enc_path = file_path + '.enc' with open(enc_path, 'wb') as f: f.write(encrypted_data) logger.info(f"[DriveSend] Created encrypted file: {enc_path}")