XSPFParser: Use percent-encoding when loading and saving playlists
Fixes #821
This commit is contained in:
@@ -75,7 +75,7 @@ Song XSPFParser::ParseTrack(QXmlStreamReader *reader, const QDir &dir, const boo
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case QXmlStreamReader::StartElement: {
|
case QXmlStreamReader::StartElement: {
|
||||||
if (name == "location") {
|
if (name == "location") {
|
||||||
location = reader->readElementText();
|
location = QUrl::fromPercentEncoding(reader->readElementText().toUtf8());
|
||||||
}
|
}
|
||||||
else if (name == "title") {
|
else if (name == "title") {
|
||||||
title = reader->readElementText();
|
title = reader->readElementText();
|
||||||
@@ -154,7 +154,7 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
|
|||||||
|
|
||||||
StreamElement tracklist("trackList", &writer);
|
StreamElement tracklist("trackList", &writer);
|
||||||
for (const Song &song : songs) {
|
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);
|
StreamElement track("track", &writer);
|
||||||
writer.writeTextElement("location", filename_or_url);
|
writer.writeTextElement("location", filename_or_url);
|
||||||
|
|||||||
Reference in New Issue
Block a user