Skip to content

Commit

Permalink
fix: handle stray /
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jan 6, 2023
1 parent 1feb825 commit 604e804
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
14 changes: 6 additions & 8 deletions storage3/_async/file_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,13 @@ async def get_public_url(self, path: str, options: TransformOptions = {}) -> str
path
file path, including the path and file name. For example `folder/image.png`.
"""
render_path = "object"
# render_path = (
# "render/image/authenticated" if options.get("transform") else "object"
# )
# transformation_query = urllib.parse.urlencode(options)
# query_string = f"?{transformation_query}" if transformation_query else ""
query_string = ""
render_path = (
"render/image/authenticated" if options.get("transform") else "object"
)
transformation_query = urllib.parse.urlencode(options)
query_string = f"/?{transformation_query}" if transformation_query else ""
_path = self._get_final_path(path)
return f"{self._client.base_url}{render_path}/public/{_path}"
return f"{self._client.base_url}{render_path}/public/{_path}{query_string}"

async def move(self, from_path: str, to_path: str) -> dict[str, str]:
"""
Expand Down
14 changes: 6 additions & 8 deletions storage3/_sync/file_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,13 @@ def get_public_url(self, path: str, options: TransformOptions = {}) -> str:
path
file path, including the path and file name. For example `folder/image.png`.
"""
render_path = "object"
# render_path = (
# "render/image/authenticated" if options.get("transform") else "object"
# )
# transformation_query = urllib.parse.urlencode(options)
# query_string = f"?{transformation_query}" if transformation_query else ""
query_string = ""
render_path = (
"render/image/authenticated" if options.get("transform") else "object"
)
transformation_query = urllib.parse.urlencode(options)
query_string = f"/?{transformation_query}" if transformation_query else ""
_path = self._get_final_path(path)
return f"{self._client.base_url}{render_path}/public/{_path}"
return f"{self._client.base_url}{render_path}/public/{_path}{query_string}"

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

0 comments on commit 604e804

Please sign in to comment.