Skip to content

Commit

Permalink
Fixed filename extraction in case of enclosing quotes.
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanoGuerrini committed Jun 5, 2024
1 parent e64c51d commit e0a1711
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hda/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ def get_filename(response, fallback):
if cd is None:
return fallback

return cd[cd.find("filename=") + len("filename=") :]
filename = cd[cd.find("filename=") + len("filename=") :]
if filename.startswith('"'):
filename = filename[1:]
if filename.endswith('"'):
filename = filename[:-1]

return filename


class HDAError(Exception):
Expand Down Expand Up @@ -262,7 +268,6 @@ def __getitem__(self, index):

def _download(self, result, download_dir: str = "."):
logger.debug(result)

self.client.accept_tac(self.dataset)

query = {
Expand Down

0 comments on commit e0a1711

Please sign in to comment.