-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/wms provider url decoding #59144
base: master
Are you sure you want to change the base?
Conversation
We should not decode an entire URL if it includes parameters, as special characters in the query string (like `&`, `=`) must remain URL-encoded to avoid breaking the structure of the request. Within the URL-parameter values must never be URL-decoded as it leads to a loss of information, this is also the case if only non reserved characters are decoded. There is no way to know whether those characters have been encoded in the first place.
…roperly decoded when retrieved, preventing any potential loss of information.
URl-encoded in URL-parameter values characters will be URL-decoded on retrieval.
🪟 Windows buildsDownload Windows builds of this PR for testing. |
…ded in tests/src/providers/testqgswmsprovider.cpp
Tagging as frozen -- this should not be merged prior to 3.40, as there's too great a risk of regressions at this late stage in the release cycle |
I agree, this needs to be done with care. So definitely not 3.40. @elpaso I will see whether it can be done when URI is serialized. |
… QgsDataSourceUri param setter and getter functions to URI serialization QgsDataSourceUri::encodedUri()
…sDataSourceUri strings in QgsDataSourceUri::setEncodedUri
…n TestQgsIdentify::identifyVectorTile(), as QgsDataSourceUri now reliably returns the values that were provided.
I set this "Ready for review" just to enable the GH actions tests but it seems like one of the maintainers has to approve them. |
Fixes #59143 - inconsistent URL encoding/decoding with WMS sources
I will take a look at tests before marking this PR ready.
May take some time as I am currently working on a 12 year old notebook.
fixed reproduction (see #59143 for a description of the current behaviour)
https://127.0.0.1/%26%3F%26%3F/?non_standard_param=%26%3F%26%3F%26%3F
https://127.0.0.1/%26?%26?/
QUrl url( txtUrl->text().trimmed() );
non_standard_param=%26%3F%26%3F%26%3F
url.setQuery( query );
https://127.0.0.1/%26%3F%26%3F/?non_standard_param=%26%3F%26%3F%26%3F
resulting in the param valuehttps%3A%2F%2F127.0.0.1%2F%2526%253F%2526%253F%2F%3Fnon_standard_param%3D%2526%253F%2526%253F%2526%253F
mUri.setParam( QStringLiteral( "url" ), url );
dpiMode=7&featureCount=10&tilePixelRatio=0&url=https%3A%2F%2F127.0.0.1%2F%2526%253F%2526%253F%2F%3Fnon_standard_param%3D%2526%253F%2526%253F%2526%253F
. The wholeurl
value is now URL-encoded making it now possible to retain the original URL.uri.setEncodedUri( mUri );
https://127.0.0.1/%26%3F%26%3F/?non_standard_param=%26%3F%26%3F%26%3F&SERVICE=WMS&REQUEST=GetCapabilities
QNetworkRequest request( url );