mirror of https://github.com/tuyoogame/YooAsset
fix #552
parent
e71077f294
commit
fe7f9bff08
|
@ -34,6 +34,20 @@ namespace YooAsset
|
|||
return str.Remove(index); //"assets/config/test.unity3d" --> "assets/config/test"
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// URL地址是否包含双斜杠
|
||||
/// 注意:只检查协议之后的部分
|
||||
/// </summary>
|
||||
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(@"\\");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合并路径
|
||||
/// </summary>
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue