[nautilus/wip/oholy/extraction-fixes: 1/5] file-operations: Remove leftover files after extraction failure
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/oholy/extraction-fixes: 1/5] file-operations: Remove leftover files after extraction failure
- Date: Fri, 24 Sep 2021 08:03:57 +0000 (UTC)
commit 8e63decb476a27f76084de5f51fa38e384180c2d
Author: Ondrej Holy <oholy redhat com>
Date: Fri Sep 24 08:40:23 2021 +0200
file-operations: Remove leftover files after extraction failure
Empty, or corrupted files are left in the output directory in the case
of extraction failure, e.g. when wrong password is supplied. This is
in most cases undesired. Let's recursively delete all the leftover
files in the case of extraction failure.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1954
src/nautilus-file-operations.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 7927bd504..c75f55d6e 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -204,6 +204,7 @@ typedef struct
GList *source_files;
GFile *destination_directory;
GList *output_files;
+ gboolean destination_decided;
gdouble base_progress;
@@ -8204,6 +8205,7 @@ extract_job_on_decide_destination (AutoarExtractor *extractor,
extract_job->output_files = g_list_prepend (extract_job->output_files,
decided_destination);
+ extract_job->destination_decided = TRUE;
return g_object_ref (decided_destination);
}
@@ -8336,6 +8338,11 @@ extract_job_on_error (AutoarExtractor *extractor,
return;
}
+ if (extract_job->destination_decided)
+ {
+ delete_file_recursively (extract_job->output_files->data, NULL, NULL, NULL);
+ }
+
basename = get_basename (source_file);
nautilus_progress_info_take_status (extract_job->common.progress,
g_strdup_printf (_("Error extracting ā%sā"),
@@ -8657,6 +8664,7 @@ extract_task_thread_func (GTask *task,
extract_job);
extract_job->archive_compressed_size = archive_compressed_sizes[i];
+ extract_job->destination_decided = FALSE;
autoar_extractor_start (extractor,
extract_job->common.cancellable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]