Skip to content

Commit 604e804

Browse files
author
joel@joellee.org
committed
fix: handle stray /
1 parent 1feb825 commit 604e804

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

storage3/_async/file_api.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,13 @@ async def get_public_url(self, path: str, options: TransformOptions = {}) -> str
8181
path
8282
file path, including the path and file name. For example `folder/image.png`.
8383
"""
84-
render_path = "object"
85-
# render_path = (
86-
# "render/image/authenticated" if options.get("transform") else "object"
87-
# )
88-
# transformation_query = urllib.parse.urlencode(options)
89-
# query_string = f"?{transformation_query}" if transformation_query else ""
90-
query_string = ""
84+
render_path = (
85+
"render/image/authenticated" if options.get("transform") else "object"
86+
)
87+
transformation_query = urllib.parse.urlencode(options)
88+
query_string = f"/?{transformation_query}" if transformation_query else ""
9189
_path = self._get_final_path(path)
92-
return f"{self._client.base_url}{render_path}/public/{_path}"
90+
return f"{self._client.base_url}{render_path}/public/{_path}{query_string}"
9391

9492
async def move(self, from_path: str, to_path: str) -> dict[str, str]:
9593
"""

storage3/_sync/file_api.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,13 @@ def get_public_url(self, path: str, options: TransformOptions = {}) -> str:
8181
path
8282
file path, including the path and file name. For example `folder/image.png`.
8383
"""
84-
render_path = "object"
85-
# render_path = (
86-
# "render/image/authenticated" if options.get("transform") else "object"
87-
# )
88-
# transformation_query = urllib.parse.urlencode(options)
89-
# query_string = f"?{transformation_query}" if transformation_query else ""
90-
query_string = ""
84+
render_path = (
85+
"render/image/authenticated" if options.get("transform") else "object"
86+
)
87+
transformation_query = urllib.parse.urlencode(options)
88+
query_string = f"/?{transformation_query}" if transformation_query else ""
9189
_path = self._get_final_path(path)
92-
return f"{self._client.base_url}{render_path}/public/{_path}"
90+
return f"{self._client.base_url}{render_path}/public/{_path}{query_string}"
9391

9492
def move(self, from_path: str, to_path: str) -> dict[str, str]:
9593
"""

0 commit comments

Comments
 (0)