Skip to content
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 ogc server encoding for IE11/Edge #3422

Merged
merged 1 commit into from Jan 23, 2018
Merged

Conversation

llienher
Copy link
Member

@llienher llienher commented Jan 19, 2018

It seems that the ogcserver sent by IE11 and Edge is the following:
"ogcserver": "Main+PNG"

while the correct format sent by Chrome and Firefox is:
"ogcserver: "Main PNG"

The wrong format causes the plus sign to be encoded into %2B, and breaks the print request.
The condition I add is not doing anything in the cases when Chrome and Firefox are sending the right value.

Fixed #3417

@llienher llienher added this to the 2.2 milestone Jan 19, 2018
@llienher llienher self-assigned this Jan 19, 2018
@@ -291,7 +291,8 @@ ngeo.Print.prototype.encodeWmsLayer_ = function(arr, opacity, url, params) {
const customParams = {'TRANSPARENT': true};
if (url_url.searchParams) {
for (const element of url_url.searchParams) {
customParams[element[0]] = element[1];
// work-around to normalize IE11 & Edge ogcserver encoding issue
element[0] === 'ogcserver' ? customParams[element[0]] = element[1].replace('+', ' ') : customParams[element[0]] = element[1];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main PNG is something we define in the Admin interface. What if the name og the ogcserver is: Mein schönes OGC server für "PNG" & nicht für "JPEG" !. (Worst name I can find).

I means, that perhaps we should escape more. Can't you have a try ?

@llienher
Copy link
Member Author

@ger-benjamin I didn't escape more than spaces, I did the test with your example and the special characters, and it worked. Note that for my test, it was the default ogc server name passed to the gmf proxy, so basically a name that would not work there first would have been impossible in the print as well:

    mapserverproxy:
        default_ogc_server: Mein schönes OGC server für "PNG" & nicht für "JPEG" !

Now the regex I use can change more than a plus sign.

Copy link
Member

@ger-benjamin ger-benjamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Thanks

@sbrunner sbrunner force-pushed the fix_ogc-server_encoding branch 6 times, most recently from 2c830e5 to 8aece15 Compare January 23, 2018 08:34
@sbrunner sbrunner merged commit cdacd17 into 2.2 Jan 23, 2018
@sbrunner sbrunner deleted the fix_ogc-server_encoding branch January 23, 2018 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants