[gnome-music/wip/jfelder/playlist-name-escape: 1/2] grltrackerplaylists: Escape playlist title on creation




commit be5b49e397e1ba5ea32327901a6ccd184660b8e6
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Feb 24 19:57:56 2021 +0100

    grltrackerplaylists: Escape playlist title on creation
    
    This prevents an error if the playlist title contains a quotation
    mark.
    
    Related: https://gitlab.gnome.org/GNOME/gnome-music/-/issues/447

 gnomemusic/grilowrappers/grltrackerplaylists.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerplaylists.py b/gnomemusic/grilowrappers/grltrackerplaylists.py
index 5bb235123..bcdc34bb8 100644
--- a/gnomemusic/grilowrappers/grltrackerplaylists.py
+++ b/gnomemusic/grilowrappers/grltrackerplaylists.py
@@ -28,7 +28,7 @@ from gettext import gettext as _
 
 import gi
 gi.require_versions({"Grl": "0.3"})
-from gi.repository import Gio, Grl, GLib, GObject
+from gi.repository import Gio, Grl, GLib, GObject, Tracker
 
 from gnomemusic.coresong import CoreSong
 import gnomemusic.utils as utils
@@ -241,7 +241,9 @@ class GrlTrackerPlaylists(GObject.GObject):
                              nie:title "%(title)s" ;
                              nfo:entryCounter 0 .
             }
-            """.replace("\n", " ").strip() % {"title": playlist_title}
+            """.replace("\n", " ").strip() % {
+                "title": Tracker.sparql_escape_string(playlist_title)
+        }
         self._tracker.update_blank_async(query, None, _create_cb, None)
 
     def check_smart_playlist_change(self):


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