Skip to content

Commit 41d7b5f

Browse files
authored
Merge pull request #1 from losynix/filename_version
Don't fail if filename doesn't have a version number
2 parents 241b874 + fdab675 commit 41d7b5f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/directory_entry/isofile.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ impl<T: ISO9660Reader> ISOFile<T> {
3737
file: FileRef<T>,
3838
) -> Result<ISOFile<T>> {
3939
// Files (not directories) in ISO 9660 have a version number, which is
40-
// provided at the end of the identifier, seperated by ';'
41-
let error = ISOError::InvalidFs("File indentifier missing ';'");
42-
let idx = identifier.rfind(';').ok_or(error)?;
43-
44-
let version = u16::from_str(&identifier[idx + 1..])?;
45-
identifier.truncate(idx);
40+
// provided at the end of the identifier, seperated by ';'.
41+
// If not, assume 1.
42+
let version = match identifier.rfind(';') {
43+
Some(idx) => {
44+
let version = u16::from_str(&identifier[idx + 1..])?;
45+
identifier.truncate(idx);
46+
version
47+
},
48+
None => 1
49+
};
4650

4751
// Files without an extension have a '.' at the end
4852
if identifier.ends_with('.') {

0 commit comments

Comments
 (0)