Skip to content

Commit

Permalink
Make signurl work with objects containing tildes
Browse files Browse the repository at this point in the history
  • Loading branch information
MewX authored May 30, 2019
1 parent 4763bcf commit 0d4d991
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions storage/google/cloud/storage/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def public_url(self):
return "{storage_base_url}/{bucket_name}/{quoted_name}".format(
storage_base_url=_API_ACCESS_ENDPOINT,
bucket_name=self.bucket.name,
quoted_name=quote(self.name.encode("utf-8")),
quoted_name=_quote(self.name),
)

def generate_signed_url(
Expand Down Expand Up @@ -417,7 +417,7 @@ def generate_signed_url(
raise ValueError("'version' must be either 'v2' or 'v4'")

resource = "/{bucket_name}/{quoted_name}".format(
bucket_name=self.bucket.name, quoted_name=quote(self.name.encode("utf-8"))
bucket_name=self.bucket.name, quoted_name=_quote(self.name)
)

if credentials is None:
Expand Down Expand Up @@ -1998,7 +1998,7 @@ def _quote(value):
:returns: The encoded value (bytes in Python 2, unicode in Python 3).
"""
value = _to_bytes(value, encoding="utf-8")
return quote(value, safe="")
return quote(value, safe=b"/~")


def _maybe_rewind(stream, rewind=False):
Expand Down

0 comments on commit 0d4d991

Please sign in to comment.