From 169024ae478d3b7e6151163bf004d4fa5829dec2 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 6 Feb 2024 17:39:43 +0100 Subject: [PATCH] Fix new asset naming to always validate filename #2212 --- Source/Editor/Windows/ContentWindow.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs index d43174cf3..68aa03678 100644 --- a/Source/Editor/Windows/ContentWindow.cs +++ b/Source/Editor/Windows/ContentWindow.cs @@ -799,7 +799,10 @@ namespace FlaxEditor.Windows if (proxy == null) throw new ArgumentNullException(nameof(proxy)); + // Setup name string name = initialName ?? proxy.NewItemName; + if (!proxy.IsFileNameValid(name) || Utilities.Utils.HasInvalidPathChar(name)) + name = proxy.NewItemName; // If the proxy can not be created in the current folder, then navigate to the content folder if (!proxy.CanCreate(CurrentViewFolder))