Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #44 #87 #71 #88

Merged
merged 7 commits into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions geoserverexplorer/gui/gsnameutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@

# noinspection PyPep8Naming
def xmlNameFixUp(name):
# TODO: handle bad unicode characters, too
n = name.replace(u' ', u'_') # doesn't hurt to always do this
if not isinstance(name, unicode):
name = name.decode('utf-8', errors='ignore')
n = unicode(unicodedata.normalize('NFKD', name).encode('ascii','ignore'))
n = re.sub('[ /\\\\]', '_', n)
if not xmlNameIsValid(n) and not n.startswith(u'_'):
rx = QRegExp(r'^(?=XML|\d|\W).*', Qt.CaseInsensitive)
if rx.exactMatch(n):
Expand Down
5 changes: 3 additions & 2 deletions geoserverexplorer/qgis/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ def publishStyle(self, layer, overwrite = True, name = None):
layer = layers.resolveLayer(layer)
sld, icons = getGsCompatibleSld(layer)
if sld is not None:
name = name if name is not None else layer.name()
name = name.replace(" ", "_")
name = name if name is not None else xmlNameFixUp(layer.name())
if layer.name() != name:
sld = sld.replace(layer.name(), name)
self.uploadIcons(icons)
self.catalog.create_style(name, sld, overwrite)
return sld
Expand Down