Skip to content

Commit cd0817b

Browse files
committed
MetaSearch: clean OWS URL when adding from search (http://hub.qgis.org/issues/16261)
1 parent b2a9a42 commit cd0817b

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

python/plugins/MetaSearch/dialogs/maindialog.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
from MetaSearch.dialogs.newconnectiondialog import NewConnectionDialog
5151
from MetaSearch.dialogs.recorddialog import RecordDialog
5252
from MetaSearch.dialogs.xmldialog import XMLDialog
53-
from MetaSearch.util import (get_connections_from_file, get_ui_class,
54-
get_help_url, highlight_xml, normalize_text,
55-
open_url, render_template, serialize_string,
56-
StaticContext)
53+
from MetaSearch.util import (clean_ows_url, get_connections_from_file,
54+
get_ui_class, get_help_url, highlight_xml,
55+
normalize_text, open_url, render_template,
56+
serialize_string, StaticContext)
5757

5858
BASE_CLASS = get_ui_class('maindialog.ui')
5959

@@ -719,7 +719,7 @@ def add_to_ows(self):
719719

720720
# no dups detected or overwrite is allowed
721721
self.settings.beginGroup('/Qgis/connections-%s' % stype[1])
722-
self.settings.setValue('/%s/url' % sname, data_url)
722+
self.settings.setValue('/%s/url' % sname, clean_ows_url(data_url))
723723
self.settings.endGroup()
724724

725725
# open provider window

python/plugins/MetaSearch/util.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from pygments import highlight
4141
from pygments.lexers import XmlLexer
4242
from pygments.formatters import HtmlFormatter
43-
from PyQt4.QtCore import QSettings
43+
from PyQt4.QtCore import QSettings, QUrl
4444
from PyQt4.QtGui import QMessageBox
4545
from PyQt4.uic import loadUiType
4646

@@ -167,3 +167,15 @@ def serialize_string(input_string):
167167
value = '%s 1' % input_string
168168

169169
return value
170+
171+
172+
def clean_ows_url(url):
173+
"""clean an OWS URL of added basic service parameters"""
174+
175+
url2 = QUrl(url)
176+
url2.removeEncodedQueryItem('service')
177+
url2.removeEncodedQueryItem('SERVICE')
178+
url2.removeEncodedQueryItem('request')
179+
url2.removeEncodedQueryItem('REQUEST')
180+
181+
return url2.toString()

0 commit comments

Comments
 (0)