Skip to content

Commit 5aefc2e

Browse files
committed
Merge pull request #108041 from bs-mwoerner/cs_get_extension
C#: Fix return value of `StringExtensions.GetExtension()`
2 parents 8431f6b + 77208a6 commit 5aefc2e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ public static string GetExtension(this string instance)
430430
{
431431
int pos = instance.RFind(".");
432432

433-
if (pos < 0)
434-
return instance;
433+
if (pos < 0 || pos < Math.Max(instance.RFind("/"), instance.RFind("\\")))
434+
return string.Empty;
435435

436436
return instance.Substring(pos + 1);
437437
}

0 commit comments

Comments
 (0)