Skip to content

Commit

Permalink
Merge pull request #397 from splunk/DVPL-10029
Browse files Browse the repository at this point in the history
Fix for Issue#361
  • Loading branch information
ashah-splunk committed Sep 23, 2021
2 parents cd742c8 + 3ce0e37 commit 10489f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions splunklib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3619,7 +3619,7 @@ def __init__(self, collection):
self.service = collection.service
self.collection = collection
self.owner, self.app, self.sharing = collection._proper_namespace()
self.path = 'storage/collections/data/' + UrlEncoded(self.collection.name) + '/'
self.path = 'storage/collections/data/' + UrlEncoded(self.collection.name, encode_slash=True) + '/'

def _get(self, url, **kwargs):
return self.service.get(self.path + url, owner=self.owner, app=self.app, sharing=self.sharing, **kwargs)
Expand Down Expand Up @@ -3657,7 +3657,7 @@ def query_by_id(self, id):
:return: Document with id
:rtype: ``dict``
"""
return json.loads(self._get(UrlEncoded(str(id))).body.read().decode('utf-8'))
return json.loads(self._get(UrlEncoded(str(id), encode_slash=True)).body.read().decode('utf-8'))

def insert(self, data):
"""
Expand Down Expand Up @@ -3693,7 +3693,7 @@ def delete_by_id(self, id):
:return: Result of DELETE request
"""
return self._delete(UrlEncoded(str(id)))
return self._delete(UrlEncoded(str(id), encode_slash=True))

def update(self, id, data):
"""
Expand All @@ -3709,7 +3709,7 @@ def update(self, id, data):
"""
if isinstance(data, dict):
data = json.dumps(data)
return json.loads(self._post(UrlEncoded(str(id)), headers=KVStoreCollectionData.JSON_HEADER, body=data).body.read().decode('utf-8'))
return json.loads(self._post(UrlEncoded(str(id), encode_slash=True), headers=KVStoreCollectionData.JSON_HEADER, body=data).body.read().decode('utf-8'))

def batch_find(self, *dbqueries):
"""
Expand Down

0 comments on commit 10489f2

Please sign in to comment.