diff --git a/Assets/YooAsset/Runtime/Utility/YooUtility.cs b/Assets/YooAsset/Runtime/Utility/YooUtility.cs
index 1f12aa62..c8df5589 100644
--- a/Assets/YooAsset/Runtime/Utility/YooUtility.cs
+++ b/Assets/YooAsset/Runtime/Utility/YooUtility.cs
@@ -34,6 +34,20 @@ namespace YooAsset
return str.Remove(index); //"assets/config/test.unity3d" --> "assets/config/test"
}
+ ///
+ /// URL地址是否包含双斜杠
+ /// 注意:只检查协议之后的部分
+ ///
+ public static bool HasDoubleSlashes(string url)
+ {
+ if (url == null)
+ throw new ArgumentNullException();
+
+ int protocolIndex = url.IndexOf("://");
+ string partToCheck = protocolIndex == -1 ? url : url.Substring(protocolIndex + 3);
+ return partToCheck.Contains("//") || partToCheck.Contains(@"\\");
+ }
+
///
/// 合并路径
///
diff --git a/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs b/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs
index c789081a..9a1b5bbb 100644
--- a/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs
+++ b/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs
@@ -198,6 +198,15 @@ internal class WechatFileSystem : IFileSystem
RemoteServices = new WebRemoteServices(webRoot);
}
+ // 检查URL双斜杠
+ // 注意:双斜杠会导致微信插件加载文件失败,但网络请求又不返回失败!
+ {
+ var mainURL = RemoteServices.GetRemoteMainURL("test.bundle");
+ var fallbackURL = RemoteServices.GetRemoteFallbackURL("test.bundle");
+ if (PathUtility.HasDoubleSlashes(mainURL) || PathUtility.HasDoubleSlashes(fallbackURL))
+ throw new Exception($"{nameof(RemoteServices)} returned URL contains double slashes. !");
+ }
+
_fileSystemMgr = WX.GetFileSystemManager();
}
public virtual void OnDestroy()