From cf9b4b12467c864af8d5728e4de4700ff0db5967 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Fri, 13 May 2022 23:32:35 +0200 Subject: [PATCH] XSPFParser: Use percent-encoding when loading and saving playlists Fixes #821 --- src/playlistparsers/xspfparser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/playlistparsers/xspfparser.cpp b/src/playlistparsers/xspfparser.cpp index f69a681de..6a596de04 100644 --- a/src/playlistparsers/xspfparser.cpp +++ b/src/playlistparsers/xspfparser.cpp @@ -75,7 +75,7 @@ Song XSPFParser::ParseTrack(QXmlStreamReader *reader, const QDir &dir, const boo switch (type) { case QXmlStreamReader::StartElement: { if (name == "location") { - location = reader->readElementText(); + location = QUrl::fromPercentEncoding(reader->readElementText().toUtf8()); } else if (name == "title") { title = reader->readElementText(); @@ -154,7 +154,7 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, StreamElement tracklist("trackList", &writer); for (const Song &song : songs) { - QString filename_or_url = URLOrFilename(song.url(), dir, path_type).toUtf8(); + QString filename_or_url = QUrl::toPercentEncoding(URLOrFilename(song.url(), dir, path_type), "/ "); StreamElement track("track", &writer); writer.writeTextElement("location", filename_or_url);