Playlist Parser: Clean the file path when loading a playlist.

This commit is contained in:
James D. Smith 2021-10-12 20:46:45 -06:00
parent 14ddc88603
commit 004c4cfe78
2 changed files with 4 additions and 2 deletions

View File

@ -53,11 +53,13 @@ void ParserBase::LoadSong(const QString& filename_or_url, qint64 beginning,
// was created on/for, using replace() lets playlists work on any platform.
filename = filename.replace('\\', '/');
// Make the path absolute
// Make the path absolute and clean it
if (!QDir::isAbsolutePath(filename)) {
filename = dir.absoluteFilePath(filename);
}
filename = QDir::cleanPath(filename);
const QUrl url = QUrl::fromLocalFile(filename);
// Search in the library

View File

@ -61,7 +61,7 @@ class ParserBase : public QObject {
protected:
// Loads a song. If filename_or_url is a URL (with a scheme other than
// "file") then it is set on the song and the song marked as a stream.
// If it is a filename or a file:// URL then it is made absolute and canonical
// If it is a filename or a file:// URL then it is made absolute and cleaned
// and set as a file:// url on the song. Also sets the song's metadata by
// searching in the Library, or loading from the file as a fallback.
// This function should always be used when loading a playlist.