Skip to content

Commit b462377

Browse files
committed
fail reading archive index if unsupported compression algo is found
1 parent ad89f26 commit b462377

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/storage/archive_index.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::error::Result;
22
use crate::storage::{compression::CompressionAlgorithm, FileRange};
3-
use anyhow::Context as _;
3+
use anyhow::{bail, Context as _};
44
use memmap2::MmapOptions;
55
use rusqlite::{Connection, OptionalExtension};
66
use serde::de::DeserializeSeed;
@@ -92,7 +92,10 @@ impl Index {
9292
zf.data_start(),
9393
zf.data_start() + zf.compressed_size() - 1,
9494
),
95-
compression: CompressionAlgorithm::Bzip2,
95+
compression: match zf.compression() {
96+
zip::CompressionMethod::Bzip2 => CompressionAlgorithm::Bzip2,
97+
c => bail!("unsupported compression algorithm {} in zip-file", c),
98+
},
9699
},
97100
);
98101
}

0 commit comments

Comments
 (0)