From 77208a62a434bc66a038271c86231c6039f623e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20W=C3=B6rner?= Date: Fri, 27 Jun 2025 11:36:55 +0200 Subject: [PATCH] Fix String.GetExtension() return value. It previously returned the string itself when it should return an empty string according to the docs/examples and the C++ counterpart String::get_extension(). --- .../mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs index 3fadfda0a3..67e52a37b0 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs @@ -430,8 +430,8 @@ namespace Godot { int pos = instance.RFind("."); - if (pos < 0) - return instance; + if (pos < 0 || pos < Math.Max(instance.RFind("/"), instance.RFind("\\"))) + return string.Empty; return instance.Substring(pos + 1); }