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" version=“1.1.0” xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:se="http://www.opengis.net/se" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<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>
- 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" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<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" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<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).
|