Skip to content

Commit c4c8dab

Browse files
authored
Merge pull request #518 from GeminiDRSoftware/dev/scorpio
Fix regression when using alternative URL in download_from_archive().
2 parents 403abcd + d8463d9 commit c4c8dab

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

astrodata/testing.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,18 @@ def download_from_archive(filename, sub_path='raw_files', env_var='DRAGONS_TEST'
256256
download_it = True
257257
local_path = os.path.join(cache_path, filename)
258258
if os.path.exists(local_path):
259-
# Get the md5 of the file on disk
260-
with open(local_path, 'rb') as filep:
261-
digest = hashlib.file_digest(filep, "md5")
262-
file_md5 = digest.hexdigest()
263-
# Get the md5 from GOA
264-
fileinfourl = url.replace('/file/', '/jsonfilelist/present/')
265-
fileinfo = requests.get(fileinfourl, headers={"User-Agent": "astropy"}).json()
266-
goa_md5 = fileinfo[0].get('data_md5')
267-
download_it = (file_md5 != goa_md5)
259+
if url.startswith(URL): # Gemini archive
260+
# Get the md5 of the file on disk
261+
with open(local_path, 'rb') as filep:
262+
digest = hashlib.file_digest(filep, "md5")
263+
file_md5 = digest.hexdigest()
264+
# Get the md5 from GOA
265+
fileinfourl = url.replace('/file/', '/jsonfilelist/present/')
266+
fileinfo = requests.get(fileinfourl, headers={"User-Agent": "astropy"}).json()
267+
goa_md5 = fileinfo[0].get('data_md5')
268+
download_it = (file_md5 != goa_md5)
269+
else:
270+
download_it = False
268271

269272
if download_it:
270273
tmp_path = download_file(url, cache=False)

0 commit comments

Comments
 (0)