[fix] Clip raster by extent/mask algorithms (avoid encoded URL inside the XML description file)#64996
Conversation
… instead of provider_metadata.decodeUri() for constructing a XML description file for WMS layers
|
Doesn't this means someone broke decodeUri for the provider? (My suspicion is #62446) |
🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. 🍎 MacOS Qt6 buildsDownload MacOS Qt6 builds of this PR for testing. |
Yes, I think so. After discussing with @benoitdm-oslandia , my understanding of the situation is the following. We store BUT we don't fully decode params when calling decodeUri(), and we should fix it by decoding them (here for instance for WMS url ). That would mean modifying all providers... @gacarrillor Your Pull request seems ok but IMHO it would be better to fix the root cause than dealing with the consequences because it could break plugins. That would be a more resilient way to fix, don't you think? @benoitdm-oslandia Do you confirm ? Can you propose a fix ? |
|
@troopa81, answers below:
We talked about it with @benoitdm-oslandia. This may be considered already as an API break, since 3rd party plugins could be relying on
Correct. We talked with @benoitdm-oslandia that the However, changing the current behavior of
I see no issues with the proposed fix in this PR, given that this is for a specific functionality (enhancing 2 processing algs.) that I added for QGIS 4.0. I proposed this fix so that our client could have their functionality working for QGIS 4.0, regardless of the status of Moreover, using On the other hand, avoiding the API break would be the most important challenge, and out of scope for me at the moment. |
|
@gacarrillor does #65114 fix the issue? |
That's the first question that we need to answer. Do we consider encoding each part in the URI an API break. Meaning that an URI was before
after
If we consider this is an API break, I propose to revert the fix instead of dealing of the aftermath of the modification. I'd say no from my point of view because the URI is more valid than before, but I can understand one think otherwise. It could break plugins that read URI elements without decoding them. Any opinion @nyalldawson @benoitdm-oslandia ?
If we fix it, like partially proposed in #65114, it wouldn't be an API break. It would be consistent with the method name that returned decoded elements.
Agreed. The PR seems good to me. But If we revert the initial PR or fix the decodeUri method, this wouldn't be needed.
Yes, but there may be other encoded parameter (url, format) to deal with in the other providers. |
Yes, it does, thanks. |
Of course, this PR was only created in reaction to the API break. |
|
My 2c:
I don't think this is an API stability issue. It probably WILL affect plugins, but we never made any statement about those URIs being in a stable format (and we break other manual project deserialisation code on a near-daily basis 😆 ) I DO think that breaking decodeUri is a regression that needs fixing. That API was designed to be the canonical way of getting human readable/usable values out of a layer's URL.
I'm -1 to reverting the fix. After looking into this, I understand the importance of the fix and the severity of the underlying issue it was designed to address. I think 4.0 is the PERFECT time to test-run a fix like this... there's going to be so many other stability issues in 4.0.x that I think a bit of short-term pain around URI handling is acceptable at this stage in the 4.x lifecycle. And I don't think we'll get that chance again till 5.0! So my question is -- if the original fix is OK and stays, then what's the best way to fix the decodeUri regression? If it's the approach from #65114, then I'll port that over to the other providers and soak in unit tests.... |
Hi! IMPOV #65114 is is the only good approach even if it means to port theses changes to all other providers. Do you need some help? |
|
@benoitdm-oslandia i've updated #65114 now so that the tests reflect the escaped values from the encodeUri call. I had a look, and can't immediately see any other providers which would require similar updates. Most rely on QgsDataSourceUri directly and have already been handled in the original fix PR. |
|
Superseded by #65114 |
Rationale:
provider_metadata.decodeUri()has changed in master (!!!), as well aslayer.publicSource()for WMS layers (they now return encoded URLs). See e.g., comment at #55318 (comment)That means the XML description file used by the aforementioned algorithms, gets an encoded URL (e.g.,
https%3A%2F%2Fplanas.frankfurt.de%2Fwms%2Fbebauungsplaene_rv_flaechennutzung) and also an encoded FORMAT parameter (e.g.,image%2Fpng), breaking the XML interpretation.Solution:
Rely on
QgsDataSourceUri()instead ofprovider_metadata.decodeUri()for constructing a XML description file for WMS layers.QgsDataSourceUri()keeps behaving as expected, that is, returning decoded params, like URL.Funded by City of Frankfurt – Stadtplanungsamt.