Skip to content

Commit e47af0e

Browse files
author
Clara Brasseur
committed
mast: allowing for file paths in filename caom column
1 parent ccc9618 commit e47af0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

astroquery/mast/observations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def download_file(self, uri, local_path=None, base_url=None, cache=True, cloud_o
535535

536536
# create a local file path if none is input. Use current directory as default.
537537
if not local_path:
538-
filename = uri.rsplit('/', 1)[-1]
538+
filename = os.path.basename(uri)
539539
local_path = os.path.join(os.path.abspath('.'), filename)
540540

541541
# recreate the data_product key for cloud connection check
@@ -606,7 +606,7 @@ def _download_files(self, products, base_dir, cache=True, cloud_only=False,):
606606
local_path = os.path.join(base_dir, data_product['obs_collection'], data_product['obs_id'])
607607
if not os.path.exists(local_path):
608608
os.makedirs(local_path)
609-
local_path = os.path.join(local_path, data_product['productFilename'])
609+
local_path = os.path.join(local_path, os.path.basename(data_product['productFilename']))
610610

611611
# download the files
612612
status, msg, url = self.download_file(data_product["dataURI"], local_path=local_path,

0 commit comments

Comments
 (0)