From f36c70c754b7bd8c2616f0e37ff4853961deb991 Mon Sep 17 00:00:00 2001 From: Aran Cox Date: Thu, 15 Jun 2017 09:00:59 -0500 Subject: [PATCH 1/3] do not quote the value in xml, use quoteattr to add quotes as needed --- beetsplug/metasync/amarok.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beetsplug/metasync/amarok.py b/beetsplug/metasync/amarok.py index aaa1ee91e..caaea72dc 100644 --- a/beetsplug/metasync/amarok.py +++ b/beetsplug/metasync/amarok.py @@ -21,7 +21,7 @@ from __future__ import division, absolute_import, print_function from os.path import basename from datetime import datetime from time import mktime -from xml.sax.saxutils import escape +from xml.sax.saxutils import quoteattr from beets.util import displayable_path from beets.dbcore import types @@ -51,7 +51,7 @@ class Amarok(MetaSource): queryXML = u' \ \ - \ + \ \ ' @@ -71,7 +71,7 @@ class Amarok(MetaSource): # for the patch relative to the mount point. But the full path is part # of the result set. So query for the filename and then try to match # the correct item from the results we get back - results = self.collection.Query(self.queryXML % escape(basename(path))) + results = self.collection.Query(self.queryXML % quoteattr(basename(path))) for result in results: if result['xesam:url'] != path: continue From 8ba0060f4472a77d1368555b6f01f4a2152a3a9e Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 15 Jun 2017 20:46:54 -0400 Subject: [PATCH 2/3] Wrap a long line --- beetsplug/metasync/amarok.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/beetsplug/metasync/amarok.py b/beetsplug/metasync/amarok.py index caaea72dc..0622fc17a 100644 --- a/beetsplug/metasync/amarok.py +++ b/beetsplug/metasync/amarok.py @@ -71,7 +71,9 @@ class Amarok(MetaSource): # for the patch relative to the mount point. But the full path is part # of the result set. So query for the filename and then try to match # the correct item from the results we get back - results = self.collection.Query(self.queryXML % quoteattr(basename(path))) + results = self.collection.Query( + self.queryXML % quoteattr(basename(path)) + ) for result in results: if result['xesam:url'] != path: continue From 63692ff9a4ba0225372b5e7dd6bb7aa2f8cbc06f Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 15 Jun 2017 21:04:16 -0400 Subject: [PATCH 3/3] Changelog for #2596 (fixes #2595) --- docs/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index b3bee8a44..01cc27cc5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -30,6 +30,8 @@ Fixes: :bug:`2583` * :doc:`/plugins/web`: Fix a crash on Windows under Python 2 when serving non-ASCII filenames. Thanks to :user:`robot3498712`. :bug:`2592` :bug:`2593` +* :doc:`/plugins/metasync`: Fix a crash in the Amarok backend when filenames + contain quotes. Thanks to :user:`aranc23`. :bug:`2595` :bug:`2596` 1.4.4 (June 10, 2017)