From 3896f1a0a52431c022f71cf954532ed68282fdf3 Mon Sep 17 00:00:00 2001 From: David Sarno Date: Thu, 12 Feb 2026 19:37:25 -0800 Subject: [PATCH] fix: catch ArgumentException from Path.IsPathRooted in IsLocalServerPath Path.IsPathRooted throws ArgumentException when the package source is a remote URL containing characters illegal in file paths. Catch the exception and return false since remote URLs are not local paths. Co-Authored-By: Claude Opus 4.6 --- MCPForUnity/Editor/Helpers/AssetPathUtility.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/MCPForUnity/Editor/Helpers/AssetPathUtility.cs b/MCPForUnity/Editor/Helpers/AssetPathUtility.cs index 34241dbd0..1af9ea236 100644 --- a/MCPForUnity/Editor/Helpers/AssetPathUtility.cs +++ b/MCPForUnity/Editor/Helpers/AssetPathUtility.cs @@ -448,8 +448,18 @@ public static bool IsLocalServerPath() return false; // Check for file:// protocol or absolute local path - return fromUrl.StartsWith("file://", StringComparison.OrdinalIgnoreCase) || - System.IO.Path.IsPathRooted(fromUrl); + if (fromUrl.StartsWith("file://", StringComparison.OrdinalIgnoreCase)) + return true; + + try + { + return System.IO.Path.IsPathRooted(fromUrl); + } + catch (System.ArgumentException) + { + // fromUrl contains characters illegal in paths (e.g. a remote URL) + return false; + } } ///