Skip to content

Commit 99bd560

Browse files
committed
Fix fq.gz input detection
1 parent 9007f0b commit 99bd560

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/map/input_chunk_reader.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,10 @@ impl InputSource {
121121
if buf[..2] == GZIP_MAGIC_NUMBER {
122122
let mut reader = bgzf::Reader::new(src);
123123
let mut buf = [0; 4];
124-
reader
125-
.read_exact(&mut buf)
126-
.map_err(|_e| Error::InvalidInputType)?;
124+
if let Err(_) = reader.read_exact(&mut buf) {
125+
// We are going to ignore this error, since we probably got GZ instead of BGZF data.
126+
// If that is not the case, potential errors are properly handled elsewhere.
127+
}
127128

128129
return if buf == BAM_MAGIC_NUMBER {
129130
Ok(Format::Bam)

0 commit comments

Comments
 (0)