From 86f4a3f003d9883a46fe3ccff2f409267252ba72 Mon Sep 17 00:00:00 2001 From: Corey Berla Date: Tue, 17 Jan 2023 17:47:18 -0800 Subject: file-operations: Don't leave partially copied file on cancelled copy If a file copy operation is cancelled, we leave a partially copied file on the destination. This is bad because it can lead to data loss is the user believes they have successfully copied their file. Let's delete the destination file, if the operation was cancelled on a copy. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1063 --- src/nautilus-file-operations.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c index cce3b2548..2d3c081d8 100644 --- a/src/nautilus-file-operations.c +++ b/src/nautilus-file-operations.c @@ -5838,6 +5838,10 @@ retry: } else if (IS_IO_ERROR (error, CANCELLED)) { + if (!copy_job->is_move) + { + g_file_delete (dest, NULL, NULL); + } g_error_free (error); } /* Other error */ -- cgit v1.2.1