From 302b2005481e7ec95075b916663373a931ef0df0 Mon Sep 17 00:00:00 2001 From: Laan Tungir Date: Sat, 27 Dec 2025 12:18:08 -0500 Subject: [PATCH] Version v0.3.48 - -m Fix directory encryption output filename - strip trailing slash from directory path --- README.md | 6 +++--- src/main.h | 2 +- src/ui.c | 13 ++++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4533310..626889e 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,14 @@ One-time pads can be trivially encrypted and decrypted using pencil and paper, m ### Download Pre-Built Binaries -**[Download Current Linux x86](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.46/otp-v0.3.46-linux-x86_64)** +**[Download Current Linux x86](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.47/otp-v0.3.47-linux-x86_64)** -**[Download Current Raspberry Pi 64](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.46/otp-v0.3.46-linux-arm64)** +**[Download Current Raspberry Pi 64](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.47/otp-v0.3.47-linux-arm64)** After downloading: ```bash # Rename for convenience, then make executable -mv otp-v0.3.46-linux-x86_64 otp +mv otp-v0.3.47-linux-x86_64 otp chmod +x otp # Run it diff --git a/src/main.h b/src/main.h index 933c601..e1d57a1 100644 --- a/src/main.h +++ b/src/main.h @@ -23,7 +23,7 @@ #include // Version - Updated automatically by build.sh -#define OTP_VERSION "v0.3.46" +#define OTP_VERSION "v0.3.47" // Constants #define MAX_INPUT_SIZE 4096 diff --git a/src/ui.c b/src/ui.c index 9d302eb..647c8b7 100644 --- a/src/ui.c +++ b/src/ui.c @@ -613,7 +613,18 @@ int handle_directory_encrypt(void) { // Generate default output filename - append .tar.gz.otp to the directory path char default_output[1024]; - snprintf(default_output, sizeof(default_output), "%s.tar.gz.otp", dir_path); + + // Remove trailing slash if present + char clean_path[512]; + strncpy(clean_path, dir_path, sizeof(clean_path) - 1); + clean_path[sizeof(clean_path) - 1] = '\0'; + + size_t path_len = strlen(clean_path); + if (path_len > 0 && clean_path[path_len - 1] == '/') { + clean_path[path_len - 1] = '\0'; + } + + snprintf(default_output, sizeof(default_output), "%s.tar.gz.otp", clean_path); // Get output filename char output_file[512];