From 621ffb823d45a88a02602fb4ee4b769dfbc0c16a Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Thu, 3 Dec 2015 10:30:14 +0100 Subject: [PATCH 24/31] fix double encoding problem with MRLs QUrl::from* can auto-encode characters such as #, toString will not automatically decode again. This results in a double encoding since MRL always encodes according to phonon-gstreamer's expectations. To avoid this use toLocalFile() for local paths as this returns decoded paths which we can then percent encode correctly. BUG: 356218 FIXED-IN: 4.9.0 CHANGELOG: Fix playback of local files containing a hash (#) character --- phonon/mrl.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phonon/mrl.cpp b/phonon/mrl.cpp index afd4655..ce5961a 100644 --- a/phonon/mrl.cpp +++ b/phonon/mrl.cpp @@ -64,12 +64,11 @@ QByteArray Mrl::toEncoded(FormattingOptions options) const { QByteArray encodedMrl; - QString url = toString(options); static QByteArray encodingExclude(":/\\?=&,@"); if (scheme() == QLatin1String("")) { - encodedMrl = QFile::encodeName("file://" + url).toPercentEncoding(encodingExclude); + encodedMrl = QFile::encodeName("file://" + toLocalFile()).toPercentEncoding(encodingExclude); } else if (scheme() == QLatin1String("file")) { - encodedMrl = QFile::encodeName(url).toPercentEncoding(encodingExclude); + encodedMrl = QFile::encodeName("file://" + toLocalFile()).toPercentEncoding(encodingExclude); } else { encodedMrl = QUrl::toEncoded(options); } -- 2.7.4