Fix files that don’t have a prefix

This commit is contained in:
Derek Briggs 2023-07-19 12:07:00 -06:00 committed by Mikayla Maki
parent c754c1e9e2
commit f4413b0969
No known key found for this signature in database
3 changed files with 10 additions and 2 deletions

View file

@ -44,7 +44,14 @@ impl FileAssociations {
let this = cx.has_global::<Self>().then(|| cx.global::<Self>())?;
iife!({
let suffix = path.extension()?.to_str()?;
let suffix =
path.file_name()
.and_then(|os_str| os_str.to_str())
.and_then(|file_name| {
file_name
.find('.')
.and_then(|dot_index| file_name.get(dot_index + 1..))
} )?;
this.suffixes
.get(suffix)