From 87d4e95a05686853ef5af355906de8b4e5fcc44e Mon Sep 17 00:00:00 2001 From: "ran.liao" Date: Thu, 3 Jul 2025 14:24:36 +0900 Subject: [PATCH 1/5] Quote the body id fragment --- python/mujinwebstackclient/webstackclient.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/mujinwebstackclient/webstackclient.py b/python/mujinwebstackclient/webstackclient.py index bbb29fc..a74dfb2 100644 --- a/python/mujinwebstackclient/webstackclient.py +++ b/python/mujinwebstackclient/webstackclient.py @@ -8,6 +8,7 @@ import os import datetime import base64 +import urllib from email.utils import parsedate import six @@ -789,6 +790,7 @@ def DownloadFile(self, filename, ifmodifiedsince=None, resolveReferences=False, params = { 'resolveReferences': 'true' if resolveReferences else 'false', } + filename = urllib.parse.quote(filename) # quote '#bodyId' into '%23BodyId' response = self._webclient.Request('GET', u'/u/%s/%s' % (self.controllerusername, filename), params=params, headers=headers, stream=True, timeout=timeout) if ifmodifiedsince and response.status_code == 304: return response From 6b33a7ee16396b4931adb27bfa98edce98975d84 Mon Sep 17 00:00:00 2001 From: "ran.liao" Date: Thu, 3 Jul 2025 14:27:06 +0900 Subject: [PATCH 2/5] Update changelog and version --- CHANGELOG.md | 4 ++++ python/mujinwebstackclient/version.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d0a639..a61c884 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.9.11 (2025-07-03) + +- Support an optional bodyId parameter when downloading environment. + ## 0.9.10 (2025-06-26) - Raise WebStack client errors with a copy of the response content instead of the implicit iterator to allow caller to deserialize the content as many times as needed. diff --git a/python/mujinwebstackclient/version.py b/python/mujinwebstackclient/version.py index b3e511a..833a502 100644 --- a/python/mujinwebstackclient/version.py +++ b/python/mujinwebstackclient/version.py @@ -1,4 +1,4 @@ -__version__ = '0.9.10' +__version__ = '0.9.11' # Do not forget to update CHANGELOG.md From 39cc3ab8b1b9cc0d7e293bb26fdf669236cc3c11 Mon Sep 17 00:00:00 2001 From: "ran.liao" Date: Thu, 3 Jul 2025 14:29:16 +0900 Subject: [PATCH 3/5] Fix typo in comment --- python/mujinwebstackclient/webstackclient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mujinwebstackclient/webstackclient.py b/python/mujinwebstackclient/webstackclient.py index a74dfb2..d582b66 100644 --- a/python/mujinwebstackclient/webstackclient.py +++ b/python/mujinwebstackclient/webstackclient.py @@ -790,7 +790,7 @@ def DownloadFile(self, filename, ifmodifiedsince=None, resolveReferences=False, params = { 'resolveReferences': 'true' if resolveReferences else 'false', } - filename = urllib.parse.quote(filename) # quote '#bodyId' into '%23BodyId' + filename = urllib.parse.quote(filename) # quote '#bodyId' into '%23bodyId' response = self._webclient.Request('GET', u'/u/%s/%s' % (self.controllerusername, filename), params=params, headers=headers, stream=True, timeout=timeout) if ifmodifiedsince and response.status_code == 304: return response From 253d76a5be0c2205171364b9c84f846f4042e923 Mon Sep 17 00:00:00 2001 From: "ran.liao" Date: Mon, 7 Jul 2025 09:09:09 +0900 Subject: [PATCH 4/5] Use uriutils.Quote --- python/mujinwebstackclient/uriutils.py | 8 ++++---- python/mujinwebstackclient/webstackclient.py | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/python/mujinwebstackclient/uriutils.py b/python/mujinwebstackclient/uriutils.py index b5c53c1..424d68d 100644 --- a/python/mujinwebstackclient/uriutils.py +++ b/python/mujinwebstackclient/uriutils.py @@ -84,7 +84,7 @@ def _Unquote(primaryKey): return _EnsureUnicode(unquote(primaryKey)) -def _Quote(primaryKey): +def Quote(primaryKey): assert isinstance(primaryKey, six.text_type) return _EnsureUTF8(quote(_EnsureUTF8(primaryKey), safe='')) @@ -485,12 +485,12 @@ def _InitFromPartType(self, partType): self._fragment = _EnsureUnicode(partTypeSegments[1]) else: basePartType = partType - self._primaryKey = _Quote(basePartType + self._suffix) + self._primaryKey = Quote(basePartType + self._suffix) def _InitFromFilename(self, filename): if self._mujinPath and filename.startswith(self._mujinPath): filename = filename[len(self._mujinPath):] - self._primaryKey = _Quote(filename) + self._primaryKey = Quote(filename) @property def scheme(self): @@ -587,7 +587,7 @@ def environmentId(self): @environmentId.setter def environmentId(self, value): - self._primaryKey = _Quote(_EnsureUnicode(value) + self._suffix) + self._primaryKey = Quote(_EnsureUnicode(value) + self._suffix) @property def filename(self): diff --git a/python/mujinwebstackclient/webstackclient.py b/python/mujinwebstackclient/webstackclient.py index d582b66..07eac71 100644 --- a/python/mujinwebstackclient/webstackclient.py +++ b/python/mujinwebstackclient/webstackclient.py @@ -8,7 +8,6 @@ import os import datetime import base64 -import urllib from email.utils import parsedate import six @@ -790,7 +789,7 @@ def DownloadFile(self, filename, ifmodifiedsince=None, resolveReferences=False, params = { 'resolveReferences': 'true' if resolveReferences else 'false', } - filename = urllib.parse.quote(filename) # quote '#bodyId' into '%23bodyId' + filename = uriutils.Quote(filename) # quote '#bodyId' into '%23bodyId' response = self._webclient.Request('GET', u'/u/%s/%s' % (self.controllerusername, filename), params=params, headers=headers, stream=True, timeout=timeout) if ifmodifiedsince and response.status_code == 304: return response From 7365e2f7f435a09906e67821ea71c4bbc489d73b Mon Sep 17 00:00:00 2001 From: "ran.liao" Date: Mon, 7 Jul 2025 10:20:45 +0900 Subject: [PATCH 5/5] Bump version number --- python/mujinwebstackclient/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mujinwebstackclient/version.py b/python/mujinwebstackclient/version.py index 6f299a5..0c9165f 100644 --- a/python/mujinwebstackclient/version.py +++ b/python/mujinwebstackclient/version.py @@ -1,3 +1,3 @@ -__version__ = '0.9.11' +__version__ = '0.9.12' # Do not forget to update CHANGELOG.md