[gnome-autoar/wip/oholy/fix-regression] extractor: Do not fail if parent folders don't exist
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-autoar/wip/oholy/fix-regression] extractor: Do not fail if parent folders don't exist
- Date: Fri, 12 Feb 2021 14:43:44 +0000 (UTC)
commit cc4e8b7ccc973ac69d75a7423fbe1bcdc51e2cb3
Author: Ondrej Holy <oholy redhat com>
Date: Fri Feb 12 11:31:16 2021 +0100
extractor: Do not fail if parent folders don't exist
Currently, it is not possible to extract archives that don't explicitly
contain parent folders. This is unintentional regression caused by commit
adb067e6. Let's simply ignore G_IO_ERROR_NOT_FOUND errors when looking
for symlinks to fix this.
Fixes: https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/11
gnome-autoar/autoar-extractor.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index a7003c1..37e57ed 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -873,6 +873,7 @@ is_valid_filename (GFile *file, GFile *destination)
{
g_autoptr (GFile) parent = NULL;
g_autoptr (GFileInfo) info = NULL;
+ g_autoptr (GError) error = NULL;
if (g_file_equal (file, destination))
return TRUE;
@@ -887,11 +888,13 @@ is_valid_filename (GFile *file, GFile *destination)
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL,
- NULL);
- if (info == NULL)
+ &error);
+
+ /* The parent directories don't have to be created yet. */
+ if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return FALSE;
- if (g_file_info_get_is_symlink (info)) {
+ if (info && g_file_info_get_is_symlink (info)) {
g_autoptr (GFile) cwd = NULL;
const gchar *target;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]