Skip to content

Commit

Permalink
fixed None path breaking in get_url()
Browse files Browse the repository at this point in the history
  • Loading branch information
arham-sayyed committed Sep 12, 2023
1 parent 0c1c9f3 commit 3233f4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyrebase/pyrebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def download(self, path, filename, token=None):
# remove leading backlash
url = self.get_url(token)
if path.startswith('/'):
path = path[1:]
path = path.lstrip('/')
if self.credentials:
blob = self.bucket.get_blob(path)
if not blob is None:
Expand All @@ -523,10 +523,10 @@ def download(self, path, filename, token=None):
f.write(chunk)

def get_url(self, token):
path = self.path
path = self.path if self.path else ''
self.path = None
if path.startswith('/'):
path = path[1:]
path = path.lstrip('/')
if token:
return "{0}/o/{1}?alt=media&token={2}".format(self.storage_bucket, quote(path, safe=''), token)
return "{0}/o/{1}?alt=media".format(self.storage_bucket, quote(path, safe=''))
Expand Down

0 comments on commit 3233f4c

Please sign in to comment.