You are able to update the content of an existing style by using Catalog.create_style() with overwrite=True, but you can't change the style version (e.g. from 1.0 to 1.1). If the existing style is 1.0 and the new content is 1.1, GeoServer tries to fix the format and completely breaks the XML.
To Reproduce
After a fresh GeoNode installation run the following script:
from geoserver.catalog import Catalog
from pathlib import Path
import time
catalog = Catalog("http://localhost/geoserver/rest")
catalog.create_style(
"test_style",
Path("sld10.xml").read_text("utf8"),
style_format="sld10"
)
time.sleep(10)
catalog.create_style(
"test_style",
Path("sld11.xml").read_text("utf8"),
style_format="sld11",
overwrite=True
)
Describe the bug
You are able to update the content of an existing style by using
Catalog.create_style()
withoverwrite=True
, but you can't change the style version (e.g. from 1.0 to 1.1). If the existing style is 1.0 and the new content is 1.1, GeoServer tries to fix the format and completely breaks the XML.To Reproduce
After a fresh GeoNode installation run the following script:
sld10.xml:
sld11.xml:
You will note the style version is still 1.0:
But the content was replaced and reverted to 1.0, and now is broken: