[Backport 5.2] squirrel: Do case-insensitive comparison of file extensions (#58091)

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

(cherry picked from commit bf65e1eb20)

Co-authored-by: Varun Gandhi <varun.gandhi@sourcegraph.com>
This commit is contained in:
sourcegraph-release-guild-bot 2023-11-03 07:27:19 -04:00 committed by GitHub
parent 61c9fea3e3
commit ca5b448a34
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
}