diff --git a/geonode/geoserver/helpers.py b/geonode/geoserver/helpers.py index d4ea1a88f7e..0f156b61b46 100755 --- a/geonode/geoserver/helpers.py +++ b/geonode/geoserver/helpers.py @@ -1151,7 +1151,7 @@ def save_style(gs_style, layer): try: style, created = Style.objects.get_or_create(name=style_name) style.workspace = gs_style.workspace - style.sld_title = gs_style.sld_title if gs_style.style_format != 'css' else sld_name + style.sld_title = gs_style.sld_title if gs_style.style_format != 'css' and gs_style.sld_title else sld_name style.sld_body = gs_style.sld_body style.sld_url = gs_style.body_href style.save() diff --git a/geonode/geoserver/views.py b/geonode/geoserver/views.py index 306365923f2..ff150f0eeb8 100644 --- a/geonode/geoserver/views.py +++ b/geonode/geoserver/views.py @@ -526,13 +526,13 @@ def strip_prefix(path, prefix): logger.debug( f"[geoserver_proxy] Updating Style ---> url {url.geturl()}") _style_name, _style_ext = os.path.splitext(os.path.basename(urlsplit(url.geturl()).path)) + _parsed_get_args = dict(parse_qsl(urlsplit(url.geturl()).query)) if _style_name == 'styles.json' and request.method == "PUT": - _parsed_get_args = dict(parse_qsl(urlsplit(url.geturl()).query)) - if 'name' in _parsed_get_args: - _style_name, _style_ext = os.path.splitext(_parsed_get_args['name']) + if _parsed_get_args.get('name'): + _style_name, _style_ext = os.path.splitext(_parsed_get_args.get('name')) else: _style_name, _style_ext = os.path.splitext(_style_name) - if _style_name != 'style-check' and _style_ext == '.json' and \ + if _style_name != 'style-check' and (_style_ext == '.json' or _parsed_get_args.get('raw')) and \ not re.match(temp_style_name_regex, _style_name): affected_layers = style_update(request, raw_url) elif downstream_path == 'rest/layers':