Repository navigation
Conversation
Without raw=true, GeoServer parses an uploaded SLD and stores its own re-encoding: the file is reformatted and its style name becomes "Default Styler", so a style exported from one GeoServer and uploaded to another no longer matches its source. The REST API already sends raw=true for MBStyle uploads; this adds an opt-in raw parameter for SLD to create_style_from_string and create_style_from_file. The default is unchanged.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Without
raw=true, GeoServer parses an uploaded SLD and stores its own re-encoding instead of the file: it is reformatted, getssld:namespace prefixes, and its style name becomes "Default Styler". A style exported from one GeoServer and uploaded to another therefore never matches its source, which breaks keeping styles in version control.The REST service already sends
raw=truefor MBStyle uploads. This adds the same option for SLD, opt-in, so the default behaviour is unchanged.Changes
RestService.create_styletakesraw: bool = False; for SLD uploads it sendsraw=truewhen set. MBStyle still always does.create_style_from_stringandcreate_style_from_filetakeraw: bool = Falseand pass it through. For.zipfiles it has no effect.Tests
New unit tests in
tests/test_style.py, usingquery_param_matcher:raw=trueis sent forcreate_style_from_file(..., raw=True)andcreate_style_from_string(..., raw=True);With the
raw=trueline removed fromRestService.create_style, exactly the tworawtests fail.Full suite: 199 passed (Python 3.14). black and isort are clean.
Checked against GeoServer Cloud 3.0.2.1 with a real SLD of 35 lines:
raw=False, the stored file differs from the upload (rewritten);raw=True, it is byte-for-byte identical.