[gnome-photos] Use double quotes around URIs



commit 881bae9a4f6e1ff36a56e12bc231bb7001c8e49e
Author: Sam Thursfield <sam afuera me uk>
Date:   Fri Dec 31 00:48:07 2021 +0000

    Use double quotes around URIs
    
    The URIs from g_file_get_uri() have double quotes (") escaped as %22
    but single quotes (') are not escaped. Leading to breakage if a
    search directory contains a single quote.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-photos/-/issues/189

 src/photos-source.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-source.c b/src/photos-source.c
index 280e4ec1..4bfcd969 100644
--- a/src/photos-source.c
+++ b/src/photos-source.c
@@ -94,7 +94,7 @@ photos_source_build_filter_local (void)
         continue;
 
       tracker_uri = photos_utils_convert_path_to_uri (tracker_dirs[i]);
-      g_string_append_printf (tracker_filter, " || fn:contains (nie:isStoredAs (?urn), '%s')", tracker_uri);
+      g_string_append_printf (tracker_filter, " || fn:contains (nie:isStoredAs (?urn), \"%s\")", 
tracker_uri);
     }
 
   path = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
@@ -109,12 +109,12 @@ photos_source_build_filter_local (void)
   export_path = g_build_filename (path, PHOTOS_EXPORT_SUBPATH, NULL);
   export_uri = photos_utils_convert_path_to_uri (export_path);
 
-  filter = g_strdup_printf ("(((fn:contains (nie:isStoredAs (?urn), '%s')"
-                            "   || fn:contains (nie:isStoredAs (?urn), '%s')"
-                            "   || fn:contains (nie:isStoredAs (?urn), '%s')"
+  filter = g_strdup_printf ("(((fn:contains (nie:isStoredAs (?urn), \"%s\")"
+                            "   || fn:contains (nie:isStoredAs (?urn), \"%s\")"
+                            "   || fn:contains (nie:isStoredAs (?urn), \"%s\")"
                             "   %s)"
-                            "  && !fn:contains (nie:isStoredAs (?urn), '%s'))"
-                            " || fn:starts-with (nao:identifier (?urn), '%s')"
+                            "  && !fn:contains (nie:isStoredAs (?urn), \"%s\"))"
+                            " || fn:starts-with (nao:identifier (?urn), \"%s\")"
                             " || (?urn = nfo:image-category-screenshot))",
                             desktop_uri,
                             download_uri,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]