Version v0.3.48 - -m Fix directory encryption output filename - strip trailing slash from directory path

This commit is contained in:
2025-12-27 12:18:08 -05:00
parent 18a4441746
commit 302b200548
3 changed files with 16 additions and 5 deletions

View File

@@ -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];