Skip to content

Commit 01e2d61

Browse files
committed
Merge pull request #631 from keflavich/alma_null
ALMA: Do not create filenames containing 'null'
2 parents 4ff2b78 + 40a21e8 commit 01e2d61

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

astroquery/alma/core.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,9 +895,11 @@ def _json_summary_to_table(self, data, base_url):
895895
"""
896896
columns = {'uid': [], 'URL': [], 'size': []}
897897
for entry in data['node_data']:
898-
is_file = (entry['de_type'] == 'MOUS' or
899-
(entry['file_name'] != 'null' and
900-
entry['file_key'] != 'null'))
898+
# de_type can be useful (e.g., MOUS), but it is not necessarily
899+
# specified
900+
# file_name and file_key *must* be specified.
901+
is_file = (entry['file_name'] != 'null' and
902+
entry['file_key'] != 'null')
901903
if is_file:
902904
# "de_name": "ALMA+uid://A001/X122/X35e",
903905
columns['uid'].append(entry['de_name'][5:])
@@ -922,6 +924,9 @@ def _json_summary_to_table(self, data, base_url):
922924
entry['file_key'],
923925
entry['file_name'],
924926
)
927+
if 'null' in url:
928+
raise ValueError("The URL {0} was created containing "
929+
"'null', which is invalid.".format(url))
925930
columns['URL'].append(url)
926931

927932
columns['size'] = u.Quantity(columns['size'], u.Gbyte)

0 commit comments

Comments
 (0)