Skip to content

Commit b586f97

Browse files
DregaringoHenriWahlAndrii Ivanov
authored
Fix double URL encoding on macOS for IcingaDBWeb (#1071)
* fix for Windows icon * fix for Windows icon uninstaller * fix sound problem * fix: resolve double URL encoding issue on macOS --------- Co-authored-by: Henri <[email protected]> Co-authored-by: Henri Wahl <[email protected]> Co-authored-by: Andrii Ivanov <[email protected]> Co-authored-by: Henri Wahl <[email protected]>
1 parent 2666844 commit b586f97

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

Nagstamon/Servers/IcingaDBWeb.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -736,18 +736,26 @@ def open_monitor(self, host, service=''):
736736
print("Cannot find {}::{}. Skipping!".format(host, service))
737737
return
738738

739-
# only type is important so do not care of service '' in case of host monitor
739+
# Generate the base path for the URL
740+
base_path = urllib.parse.urlparse(self.monitor_url).path
741+
742+
# Handle URL for host monitoring
740743
if service == '':
741-
url = '{0}/icingadb/hosts?host.state.is_problem=y&sort=host.state.severity#!{1}/icingadb/host?{2}'.format(self.monitor_url,
742-
(urllib.parse.urlparse(self.monitor_url).path),
743-
urllib.parse.urlencode(
744-
{'name': self.hosts[host].real_name}).replace('+', ' '))
744+
url = '{0}/icingadb/hosts?host.state.is_problem=y&sort=host.state.severity#!{1}/icingadb/host?{2}'.format(
745+
self.monitor_url,
746+
base_path,
747+
urllib.parse.urlencode({'name': self.hosts[host].real_name}, quote_via=quote)
748+
)
745749
else:
746-
url = '{0}/icingadb/services?service.state.is_problem=y&sort=service.state.severity%20desc#!{1}/icingadb/service?{2}'.format(self.monitor_url,
747-
(urllib.parse.urlparse(self.monitor_url).path),
748-
urllib.parse.urlencode(
749-
{'name': self.hosts[host].services[service].real_name,
750-
'host.name': self.hosts[host].real_name}).replace('+', ' '))
750+
# Handle URL for service monitoring
751+
url = '{0}/icingadb/services?service.state.is_problem=y&sort=service.state.severity%20desc#!{1}/icingadb/service?{2}'.format(
752+
self.monitor_url,
753+
base_path,
754+
urllib.parse.urlencode({
755+
'name': self.hosts[host].services[service].real_name,
756+
'host.name': self.hosts[host].real_name
757+
}, quote_via=urllib.parse.quote)
758+
)
751759
if conf.debug_mode:
752760
self.debug(server=self.get_name(), host=host, service=service,
753761
debug='[Open monitor] Open host/service monitor web page {0}'.format(url))

0 commit comments

Comments
 (0)