mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
Clean up code and add some explanation in comments
This commit is contained in:
@@ -948,15 +948,15 @@ 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( "*", "%2A" );
|
|
||||||
// data.replace( ":", "%3A" );
|
|
||||||
// data.replace( ";", "%3B" );
|
|
||||||
|
|
||||||
data.replace( "%20", "+" );
|
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" );
|
||||||
|
Reference in New Issue
Block a user