Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 42e075d

Browse files
Dave BartolomeoDave Bartolomeo
authored andcommitted
Fix path transformer handling of extensionless files
1 parent fa344d2 commit 42e075d

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

csharp/extractor/Semmle.Extraction/PathTransformer.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,21 @@ private struct TransformedPath : ITransformedPath
4444

4545
public string Value => value;
4646

47-
public string Extension => Path.GetExtension(value)?.Substring(1) ?? "";
47+
public string Extension
48+
{
49+
get
50+
{
51+
var extension = Path.GetExtension(value);
52+
if (string.IsNullOrEmpty(extension))
53+
{
54+
return "";
55+
}
56+
else
57+
{
58+
return extension.Substring(1);
59+
}
60+
}
61+
}
4862

4963
public string NameWithoutExtension => Path.GetFileNameWithoutExtension(value);
5064

0 commit comments

Comments
 (0)