Andrea Aime ( 
https://osgeo-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae9469ffc-5e16-4c2b-b7b0-b9c46e912f9e
 ) *created* an issue

GeoServer ( 
https://osgeo-org.atlassian.net/browse/GEOS?atlOrigin=eyJpIjoiNDJlNTRhZDFmNWUxNGViMjhmOWM2ZjgyNDFiZjAyYjciLCJwIjoiaiJ9
 ) / Bug ( 
https://osgeo-org.atlassian.net/browse/GEOS-10437?atlOrigin=eyJpIjoiNDJlNTRhZDFmNWUxNGViMjhmOWM2ZjgyNDFiZjAyYjciLCJwIjoiaiJ9
 ) GEOS-10437 ( 
https://osgeo-org.atlassian.net/browse/GEOS-10437?atlOrigin=eyJpIjoiNDJlNTRhZDFmNWUxNGViMjhmOWM2ZjgyNDFiZjAyYjciLCJwIjoiaiJ9
 ) Breaking SLD 1.1 style by REST upload ( 
https://osgeo-org.atlassian.net/browse/GEOS-10437?atlOrigin=eyJpIjoiNDJlNTRhZDFmNWUxNGViMjhmOWM2ZjgyNDFiZjAyYjciLCJwIjoiaiJ9
 )

Issue Type: Bug Assignee: Unassigned Created: 30/Mar/22 6:54 PM Priority: 
Medium Reporter: Andrea Aime ( 
https://osgeo-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae9469ffc-5e16-4c2b-b7b0-b9c46e912f9e
 )

It is possible to make a style unusable by using the REST API, with a legit 
operation.

* Start by configuring a SLD 1.1 style, for example:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns=" http://www.opengis.net/sld"; ( 
http://www.opengis.net/sld%22 ) version="1.1.0" xmlns:ogc=" 
http://www.opengis.net/ogc"; ( http://www.opengis.net/ogc%22 ) xmlns:xlink=" 
http://www.w3.org/1999/xlink"; ( http://www.w3.org/1999/xlink%22 ) xmlns:se=" 
http://www.opengis.net/se"; ( http://www.opengis.net/se%22 ) 
xsi:schemaLocation=" http://www.opengis.net/sld 
http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd"; ( 
http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd%22 ) xmlns:xsi=" 
http://www.w3.org/2001/XMLSchema-instance"; ( 
http://www.w3.org/2001/XMLSchema-instance%22 ) >
<NamedLayer>
[se:Name|se:Name] 312</se:Name>
<UserStyle>
[se:Name|se:Name] 312</se:Name>
[se:FeatureTypeStyle|se:FeatureTypeStyle]
[se:Rule|se:Rule]
[se:Name|se:Name] Single symbol</se:Name>
[se:PolygonSymbolizer|se:PolygonSymbolizer]
[se:Stroke|se:Stroke]
<se:SvgParameter name="stroke">#e5ba38</se:SvgParameter>
<se:SvgParameter name="stroke-width">2</se:SvgParameter>
<se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
</se:Stroke>
</se:PolygonSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

2) Using the REST API, upload a SLD 1.0 style on top of it, without any 
parameter in the request (don’t use “raw=true” or the issue won’t appear:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<StyledLayerDescriptor version="1.0.0" xsi:schemaLocation=" 
http://www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns=" 
http://www.opengis.net/sld"; ( http://www.opengis.net/sld%22 ) xmlns:ogc=" 
http://www.opengis.net/ogc"; ( http://www.opengis.net/ogc%22 ) xmlns:xlink=" 
http://www.w3.org/1999/xlink"; ( http://www.w3.org/1999/xlink%22 ) xmlns:xsi=" 
http://www.w3.org/2001/XMLSchema-instance"; ( 
http://www.w3.org/2001/XMLSchema-instance%22 ) >
<NamedLayer>
<Name>312</Name>
<UserStyle>
<Name>312</Name>
<Title>312</Title>
<FeatureTypeStyle>
<Rule>
<Name>Single symbol</Name>
<PolygonSymbolizer>
<Stroke>
<CssParameter name="stroke">#f8e71c</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-opacity">1</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

e..g, as CURL:

curl --request PUT
--url http://localhost:8080/geoserver/rest/styles/312
--header 'authorization: Basic YWRtaW46Z2Vvc2VydmVy'
--header 'content-type: application/vnd.ogc.sld+xml'
--cookie JSESSIONID=449sfk03x2svnsq6y1uoyjwq
--data '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<StyledLayerDescriptor version="1.0.0" xsi:schemaLocation=" 
http://www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns=" 
http://www.opengis.net/sld"; ( http://www.opengis.net/sld%22 ) xmlns:ogc=" 
http://www.opengis.net/ogc"; ( http://www.opengis.net/ogc%22 ) xmlns:xlink=" 
http://www.w3.org/1999/xlink"; ( http://www.w3.org/1999/xlink%22 ) xmlns:xsi=" 
http://www.w3.org/2001/XMLSchema-instance"; ( 
http://www.w3.org/2001/XMLSchema-instance%22 ) >
<NamedLayer>
<Name>312</Name>
<UserStyle>
<Name>312</Name>
<Title>312</Title>
<FeatureTypeStyle>
<Rule>
<Name>Single symbol</Name>
<PolygonSymbolizer>
<Stroke>
<CssParameter name="stroke">#f8e71c</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-opacity">1</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>'

Result: the style internal version remains 1.1, and the SLD in the editor is 
fully ruined.

Expected result: the version is switched to 1.0 and the SLD matches the one 
uploaded (minus the reformatting happening in the middle, when “raw=true” is 
missing).

( 
https://osgeo-org.atlassian.net/browse/GEOS-10437#add-comment?atlOrigin=eyJpIjoiNDJlNTRhZDFmNWUxNGViMjhmOWM2ZjgyNDFiZjAyYjciLCJwIjoiaiJ9
 ) Add Comment ( 
https://osgeo-org.atlassian.net/browse/GEOS-10437#add-comment?atlOrigin=eyJpIjoiNDJlNTRhZDFmNWUxNGViMjhmOWM2ZjgyNDFiZjAyYjciLCJwIjoiaiJ9
 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( 
https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail
 ) or iOS ( 
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8
 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100197- 
sha1:666e164 )
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to