1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-18 20:04:00 +02:00

Clean up code and add some explanation in comments

Conflicts:
	src/libtomahawk/utils/TomahawkUtils.cpp
This commit is contained in:
Jeff Mitchell
2014-11-07 16:05:41 -05:00
parent be188c318a
commit bbce84d569

View File

@@ -948,16 +948,16 @@ urlSetQuery( QUrl& url, const QString& query )
QByteArray QByteArray
percentEncode( const QUrl& url ) percentEncode( const QUrl& url )
{ {
//NOTE: this function does not exhaustively replace things that QUrl
//sometimes misses, however adding those in this function (like in
//encodedQuery()) causes some things like toma.hk link generation to
//fail, so leave them out here
QByteArray data = url.toEncoded(); QByteArray data = url.toEncoded();
// QUrl doesn't encode ', which it doesn't have to. Some apps don't like ' though, and want %27. Both are valid. It also doesn't encode : or ; which it should, so be safer here in general. // QUrl doesn't encode ', which it doesn't have to. Some apps don't like ' though, and want %27. Both are valid.
data.replace( "'", "%27" ); data.replace( "'", "%27" );
data.replace( ".", "%2E" ); data.replace( "%20", "+" );
data.replace( "*", "%2A" );
data.replace( ":", "%3A" );
data.replace( ";", "%3B" );
data.replace( "%20", "+" );
return data; return data;
} }
@@ -972,6 +972,7 @@ encodedQuery( const QUrl& url )
#else #else
data = url.encodedQuery(); data = url.encodedQuery();
#endif #endif
// QUrl doesn't encode : or ; which it should, as well as some other things, so be safer here in general.
data.replace( "'", "%27" ); data.replace( "'", "%27" );
data.replace( ".", "%2E" ); data.replace( ".", "%2E" );
data.replace( "*", "%2A" ); data.replace( "*", "%2A" );