geoext1 icon indicating copy to clipboard operation
geoext1 copied to clipboard

baseParams duplicated on WMSLegend

Open ahocevar opened this issue 12 years ago • 2 comments

If a WMSLegend is configured with a URL, and baseParams e.g. contain a FORMAT, the FORMAT gets appended even if the original URL already has a FORMAT param.

We really need to turn all params into an object, uppercase them, and compare them against uppercased baesParams to make sure we don't duplicate any. Whether we override or ignore is a different question - but baseParams implies that we ignore params that are in the URL already.

ahocevar avatar Jun 30 '12 13:06 ahocevar

AFAICT there is already a check for FORMAT in the code, so it will not be duplicated currently. There is even a test-case that accounts for this case.

Are you suggesting to do this for any baseParam @ahocevar ?

bartvde avatar Sep 11 '12 12:09 bartvde

I'm finding GeoExt.WMSLegend is still appending two times "format=" to the legend url. This gives the same problems reported in #434: http://trac.geoext.org/ticket/434

I find that when url has already got format option and also params has the format option too, in the final lines they get appended in the final url:

url = Ext.urlAppend(url, Ext.urlEncode(params));

This causes the same duplication of format option.

I hacked it quickly with this at the end of the getLegendUrl method:

//avoid duplicated format option

if(params.hasOwnProperty('format') && url.toLowerCase().indexOf("format=") > -1) delete params.format; url = Ext.urlAppend(url, Ext.urlEncode(params));

This works for me.

This happens in http://suite.opengeo.org/geoexplorer.

WMS url to replicate: http://sigims.edia.pt/EDIASIG/AGSProxy/proxy.ashx?key=EDIA_SGRCacheWMSMerc

I can see the legend request: http://sigims.edia.pt/EDIASIG/AGSProxy/proxy.ashx?key=EDIA_SGRCacheWMSMerc?request=GetLegendGraphic%26version=1.1.1%26format=image/png%26layer=5&transparent=true&format=image%2Fpng&legend_options=fontAntiAliasing%3Atrue%3BfontSize%3A11%3BfontName%3AArial&SCALE=1091958.1364361627

Duarte

dncpax avatar Nov 19 '12 17:11 dncpax