Skip to content

Commit 428bbb4

Browse files
authored
Merge pull request #2319 from jd-au/CASDA-Download-file-names-with-plus
Decode plus signs in filenames when downloading
2 parents 5258370 + 09f07d2 commit 428bbb4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

astroquery/casda/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def download_files(self, urls, savedir=''):
241241
filenames = []
242242
for url in urls:
243243
parseResult = urlparse(url)
244-
local_filename = os.path.basename(parseResult.path)
244+
local_filename = unquote(os.path.basename(parseResult.path))
245245
if os.name == 'nt':
246246
# Windows doesn't allow special characters in filenames like
247247
# ":" so replace them with an underscore

astroquery/casda/tests/test_casda.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ def test_stage_data(patch_get):
284284

285285
def test_download_file(patch_get):
286286
urls = ['https://ingest.pawsey.org/bucket_name/path/askap_img.fits?security=stuff',
287-
'http://casda.csiro.au/download/web/111-000-111-000/askap_img.fits.checksum']
287+
'http://casda.csiro.au/download/web/111-000-111-000/askap_img.fits.checksum',
288+
'https://ingest.pawsey.org.au/casda-prd-as110-01/dc52217/primary_images/RACS-DR1_0000%2B18A.fits?security=stuff']
288289
casda = Casda('user', 'password')
289290

290291
# skip the actual downloading of the file
@@ -294,3 +295,4 @@ def test_download_file(patch_get):
294295
filenames = casda.download_files(urls)
295296
assert filenames[0].endswith('askap_img.fits')
296297
assert filenames[1].endswith('askap_img.fits.checksum')
298+
assert filenames[2].endswith('RACS-DR1_0000+18A.fits')

0 commit comments

Comments
 (0)