diff --git a/qiita_core/tests/test_util.py b/qiita_core/tests/test_util.py index bb95909a2..a3fef6942 100644 --- a/qiita_core/tests/test_util.py +++ b/qiita_core/tests/test_util.py @@ -72,15 +72,15 @@ def test_get_release_info(self): biom_metadata_release, archive_release = get_release_info('private') # note that we are testing not equal as we should have some information # and then we will test that at least the 2nd element is correct - self.assertNotEqual(biom_metadata_release, (b'', b'', b'')) + self.assertNotEqual(biom_metadata_release, ('', '', '')) self.assertEqual(biom_metadata_release[1], - b'releases/QIITA-private.tgz') - self.assertEqual(archive_release, (b'', b'', b'')) + 'releases/QIITA-private.tgz') + self.assertEqual(archive_release, ('', '', '')) generate_plugin_releases() biom_metadata_release, archive_release = get_release_info('public') - self.assertEqual(biom_metadata_release, (b'', b'', b'')) - self.assertNotEqual(archive_release, (b'', b'', b'')) + self.assertEqual(biom_metadata_release, ('', '', '')) + self.assertNotEqual(archive_release, ('', '', '')) if __name__ == '__main__': diff --git a/qiita_core/util.py b/qiita_core/util.py index 2cc5b54ba..b3f6b4142 100644 --- a/qiita_core/util.py +++ b/qiita_core/util.py @@ -135,12 +135,9 @@ def get_release_info(study_status='public'): timestamp = r_client.get('%s:release:%s:time' % (portal, study_status)) # replacing None values for empty strings as the text is displayed nicely # in the GUI - if md5sum is None: - md5sum = b'' - if filepath is None: - filepath = b'' - if timestamp is None: - timestamp = b'' + md5sum = '' if md5sum is None else md5sum.decode('ascii') + filepath = '' if filepath is None else filepath.decode('ascii') + timestamp = '' if timestamp is None else timestamp.decode('ascii') biom_metadata_release = ((md5sum, filepath, timestamp)) md5sum = r_client.get('release-archive:md5sum') @@ -148,12 +145,9 @@ def get_release_info(study_status='public'): timestamp = r_client.get('release-archive:time') # replacing None values for empty strings as the text is displayed nicely # in the GUI - if md5sum is None: - md5sum = b'' - if filepath is None: - filepath = b'' - if timestamp is None: - timestamp = b'' + md5sum = '' if md5sum is None else md5sum.decode('ascii') + filepath = '' if filepath is None else filepath.decode('ascii') + timestamp = '' if timestamp is None else timestamp.decode('ascii') archive_release = ((md5sum, filepath, timestamp)) return (biom_metadata_release, archive_release) diff --git a/qiita_pet/handlers/download.py b/qiita_pet/handlers/download.py index daa296a67..ba7e54131 100644 --- a/qiita_pet/handlers/download.py +++ b/qiita_pet/handlers/download.py @@ -266,7 +266,7 @@ def get(self, extras): self.set_header('Content-Type', 'application/octet-stream') self.set_header('Content-Transfer-Encoding', 'binary') self.set_header('X-Accel-Redirect', - '/protected-working_dir/' + relpath.decode('ascii')) + f'/protected-working_dir/{relpath}') self.finish()