For windows, when adding local files (served via internal HTTP server) add

the real file path as a query item.
Issue #1250
This commit is contained in:
Craig Drummond
2018-04-30 18:00:15 +01:00
committed by Craig Drummond
parent 390d4d7239
commit ab60d6225b
2 changed files with 11 additions and 3 deletions

View File

@@ -169,7 +169,12 @@ QByteArray HttpServer::encodeUrl(const Song &s)
url.setScheme("http");
url.setHost(currentIfaceIp);
url.setPort(socket->serverPort());
#ifdef Q_OS_WIN
// Use a query item, as s.file might have a driver specifier
query.addQueryItem("file", s.file);
#else
url.setPath(s.file);
#endif
if (!s.album.isEmpty()) {
query.addQueryItem("album", s.album);
}
@@ -285,11 +290,12 @@ Song HttpServer::decodeUrl(const QUrl &url) const
if (q.hasQueryItem("onlineservice")) {
s.setIsFromOnlineService(q.queryItemValue("onlineservice"));
}
s.file=url.path();
s.type=Song::CantataStream;
#ifdef Q_OS_WIN
s.file=fixWindowsPath(s.file);
s.file=fixWindowsPath(q.queryItemValue("file"));
#else
s.file=url.path();
#endif
s.type=Song::CantataStream;
#if defined CDDB_FOUND || defined MUSICBRAINZ5_FOUND
if (s.file.startsWith(Song::constCddaProtocol)) {
s.type=Song::Cdda;