mirror of
https://github.com/sharkdp/bat
synced 2024-11-18 15:26:16 +00:00
Abort ignored filename suffix stripping early on unworkable filenames
This commit is contained in:
parent
dc8ab0b5ce
commit
21338ed789
@ -291,12 +291,13 @@ impl HighlightingAssets {
|
|||||||
.and_then(|x| x.to_str())
|
.and_then(|x| x.to_str())
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
).or_else(|| {
|
).or_else(|| {
|
||||||
let file_str = file_path.to_str().unwrap_or_default();
|
if let Some(file_str) = file_path.to_str() {
|
||||||
for suffix in IGNORED_SUFFIXES.iter() {
|
for suffix in IGNORED_SUFFIXES.iter() {
|
||||||
if let Some(stripped_filename) = file_str.strip_suffix(suffix) {
|
if let Some(stripped_filename) = file_str.strip_suffix(suffix) {
|
||||||
return self.get_extension_syntax(OsStr::new(stripped_filename));
|
return self.get_extension_syntax(OsStr::new(stripped_filename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user