Skip to content

Commit d5dd4b2

Browse files
author
Fred Ross
committed
Added URL forbidden character encoding for owner, app, etc.
1 parent b4fc25f commit d5dd4b2

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎splunklib/binding.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,15 @@ def fullpath(self, path, **kwargs):
234234

235235
# If no app or owner are specified, then use the /services endpoint
236236
if ns.app is None and ns.owner is None:
237-
return "/services/%s" % path
237+
return "/services/%s" % urllib.quote(path)
238238

239239
# At least one of app or owner is specified, so use the /serviceNS
240240
# endpoint and if only one is specified, then wildcard the other.
241241
oname = "-" if ns.owner is None else ns.owner
242242
aname = "-" if ns.app is None else ns.app
243-
return "/servicesNS/%s/%s/%s" % (oname, aname, path)
243+
return "/servicesNS/%s/%s/%s" % (urllib.quote(oname),
244+
urllib.quote(aname),
245+
urllib.quote(path))
244246

245247
# Convert the given path into a fully qualified URL by first qualifying
246248
# the given path with namespace segments if necessarry and then prefixing

‎tests/test_saved_search.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def test_crud(self):
8888
saved_search.refresh()
8989
self.check_content(saved_search, is_visible=0)
9090

91+
self.assertRaises(ValueError, saved_search.update, saved_search, name="Anything")
92+
9193
saved_searches.delete('sdk-test1')
9294
self.assertFalse('sdk-test1' in saved_searches)
9395

0 commit comments

Comments
 (0)