squirrel: Do case-insensitive comparison of file extensions (#58069)

This commit is contained in:
Varun Gandhi 2023-11-03 13:35:26 +08:00 committed by GitHub
parent c7ac58652b
commit bf65e1eb20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -51,9 +51,7 @@
"h++",
"hh",
"h",
"hpp",
"pc",
"pcc"
"hpp"
],
"csharp": [
"cs",

View File

@ -246,7 +246,10 @@ func (s *SquirrelService) parse(ctx context.Context, repoCommitPath types.RepoCo
ext = strings.TrimPrefix(filepath.Ext(repoCommitPath.Path), ".")
}
langName, ok := extToLang[ext]
// It is not uncommon to have files with upper-case extensions
// like .C, .H, .CPP etc., especially for code developed on
// case-insensitive filesystems.
langName, ok := extToLang[strings.ToLower(ext)]
if !ok {
return nil, unrecognizedFileExtensionError
}