From 516bd1a9d6003711b0ba42e3dcd233997f6cf777 Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Fri, 24 Nov 2017 00:18:27 +0100 Subject: 7z: Fix: rename files with password without the list encrypted --- src/fr-command-7z.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c index ffccc94..a41f97d 100644 --- a/src/fr-command-7z.c +++ b/src/fr-command-7z.c @@ -39,8 +39,11 @@ static void fr_command_7z_class_init (FrCommand7zClass *class); static void fr_command_7z_init (FrCommand *afile); static void fr_command_7z_finalize (GObject *object); + static gboolean spd_support = FALSE; static gboolean unexpected_end_of_archive = FALSE; +static gboolean password_required = FALSE; +static gboolean password_handled = FALSE; /* Parent Class */ @@ -225,6 +228,7 @@ add_password_arg (FrCommand *comm, arg = g_strconcat ("-p", password, NULL); fr_process_add_arg (comm->process, arg); g_free (arg); + password_handled = TRUE; } } @@ -284,6 +288,9 @@ process_line__add (char *line, { FrCommand *comm = FR_COMMAND (data); + if (strstr (line, "Enter password") != NULL) + password_required = TRUE; + if ((comm->volume_size > 0) && (strncmp (line, "Creating archive", 16) == 0)) { char *volume_filename; GFile *volume_file; @@ -550,6 +557,12 @@ fr_command_7z_handle_error (FrCommand *comm, error->type = FR_PROC_ERROR_NONE; } else { + if (password_required && (!password_handled)) + { + error->type = FR_PROC_ERROR_ASK_PASSWORD; + return; + } + GList *scan; for (scan = g_list_last (comm->process->out.raw); scan; scan = scan->prev) { -- cgit v1.2.1