Skip to content

Commit e8ceebd

Browse files
authored
Merge pull request #740 from MSeifert04/fix-739
decode row run2d to ensure there is no binary prefix included in sdss url
2 parents daa2d3f + 5c9477c commit e8ceebd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

astroquery/sdss/core.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,11 +575,17 @@ def get_spectra_async(self, coordinates=None, radius=2. * u.arcsec,
575575
results = []
576576
for row in matches:
577577
linkstr = self.SPECTRA_URL_SUFFIX
578-
# _parse_result returns bytes for instruments, requiring a decode
578+
# _parse_result returns bytes (requiring a decode) for
579+
# - instruments
580+
# - run2d sometimes (#739)
581+
if isinstance(row['run2d'], bytes):
582+
run2d = row['run2d'].decode()
583+
else:
584+
run2d = row['run2d']
579585
link = linkstr.format(
580586
base=conf.sas_baseurl, dr=data_release,
581587
instrument=row['instrument'].decode().lower(),
582-
run2d=row['run2d'], plate=row['plate'],
588+
run2d=run2d, plate=row['plate'],
583589
fiber=row['fiberID'], mjd=row['mjd'])
584590

585591
results.append(commons.FileContainer(link,

0 commit comments

Comments
 (0)