mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-11-04 09:01:56 +00:00 
			
		
		
		
	Abort ignored filename suffix stripping early on unworkable filenames
This commit is contained in:
		@@ -291,10 +291,11 @@ impl HighlightingAssets {
 | 
			
		||||
                        .and_then(|x| x.to_str())
 | 
			
		||||
                        .unwrap_or_default(),
 | 
			
		||||
                ).or_else(|| {
 | 
			
		||||
                    let file_str = file_path.to_str().unwrap_or_default();
 | 
			
		||||
                    for suffix in IGNORED_SUFFIXES.iter() {
 | 
			
		||||
                        if let Some(stripped_filename) = file_str.strip_suffix(suffix) {
 | 
			
		||||
                            return self.get_extension_syntax(OsStr::new(stripped_filename));
 | 
			
		||||
                    if let Some(file_str) = file_path.to_str() {
 | 
			
		||||
                        for suffix in IGNORED_SUFFIXES.iter() {
 | 
			
		||||
                            if let Some(stripped_filename) = file_str.strip_suffix(suffix) {
 | 
			
		||||
                                return self.get_extension_syntax(OsStr::new(stripped_filename));
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    None
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user