diff --git a/src/xls.rs b/src/xls.rs index b925e014..7c40ef00 100644 --- a/src/xls.rs +++ b/src/xls.rs @@ -280,7 +280,8 @@ impl Xls { for record in records { let mut r = record?; match r.typ { - 0x0012 if read_u16(r.data) != 0 => return Err(XlsError::Password), + // 2.4.117 FilePass + 0x002F if read_u16(r.data) != 0 => return Err(XlsError::Password), // CodePage 0x0042 => { if self.options.force_codepage.is_none() { diff --git a/tests/issue_385.xls b/tests/issue_385.xls new file mode 100644 index 00000000..5b5d3a7d Binary files /dev/null and b/tests/issue_385.xls differ diff --git a/tests/test.rs b/tests/test.rs index 41453f37..b1803a9d 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1514,3 +1514,16 @@ fn issue_374() { assert_eq!("sheetjs", cell_text); } + +#[test] +fn issue_385() { + let path = format!("{}/tests/issue_385.xls", env!("CARGO_MANIFEST_DIR")); + + assert!( + matches!( + open_workbook::, std::string::String>(path), + Err(calamine::XlsError::Password) + ), + "Is expeced to return XlsError::Password error" + ); +}