diff --git a/lib/galaxy/datatypes/sequence.py b/lib/galaxy/datatypes/sequence.py index 911a1a2db31a..71fbc0ec8d9c 100644 --- a/lib/galaxy/datatypes/sequence.py +++ b/lib/galaxy/datatypes/sequence.py @@ -774,7 +774,7 @@ def display_data( ): headers = kwd.get("headers", {}) if preview: - with compression_utils.get_fileobj(dataset.get_file_name()) as fh: + with compression_utils.get_fileobj(dataset.get_file_name(), "rb") as fh: max_peek_size = 1000000 # 1 MB if os.stat(dataset.get_file_name()).st_size < max_peek_size: mime = "text/plain" diff --git a/lib/galaxy/datatypes/tabular.py b/lib/galaxy/datatypes/tabular.py index 5b4e1d523e12..ea381d1f9c0b 100644 --- a/lib/galaxy/datatypes/tabular.py +++ b/lib/galaxy/datatypes/tabular.py @@ -154,12 +154,12 @@ def get_chunk(self, trans, dataset: HasFileName, offset: int = 0, ck_size: Optio ) def _read_chunk(self, trans, dataset: HasFileName, offset: int, ck_size: Optional[int] = None): - with compression_utils.get_fileobj(dataset.get_file_name()) as f: + with compression_utils.get_fileobj(dataset.get_file_name(), "rb") as f: f.seek(offset) ck_data = f.read(ck_size or trans.app.config.display_chunk_size) - if ck_data and ck_data[-1] != "\n": + if ck_data and ck_data[-1] != b"\n": cursor = f.read(1) - while cursor and cursor != "\n": + while cursor and cursor != b"\n": ck_data += cursor cursor = f.read(1) last_read = f.tell()