From be3fa0b688ac03ad03d5728616d604597eb54c44 Mon Sep 17 00:00:00 2001 From: Pro-Ly <849297348@qq.com> Date: Wed, 31 Jul 2024 23:28:47 +0800 Subject: [PATCH] fix url path special cases --- .../DownloadSystem/DownloadSystemHelper.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs index 55a7a9b..4a574a1 100644 --- a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs +++ b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs @@ -25,26 +25,28 @@ namespace YooAsset /// public static string ConvertToWWWPath(string path) { + string urlPath; #if UNITY_EDITOR - return StringUtility.Format("file:///{0}", path); + urlPath = StringUtility.Format("file:///{0}", path); #elif UNITY_WEBGL - return path; + urlPath = path; #elif UNITY_IPHONE - return StringUtility.Format("file://{0}", path); + urlPath = StringUtility.Format("file://{0}", path); #elif UNITY_ANDROID if (path.StartsWith("jar:file://")) - return path; + urlPath = path; else - return StringUtility.Format("jar:file://{0}", path); + urlPath = StringUtility.Format("jar:file://{0}", path); #elif UNITY_STANDALONE_OSX - return new System.Uri(path).ToString(); + urlPath = new System.Uri(path).ToString(); #elif UNITY_STANDALONE - return StringUtility.Format("file:///{0}", path); + urlPath = StringUtility.Format("file:///{0}", path); #elif UNITY_OPENHARMONY - return StringUtility.Format("file://{0}", path); + urlPath = StringUtility.Format("file://{0}", path); #else - throw new System.NotImplementedException(); + throw new System.NotImplementedException(); #endif + return urlPath.Replace("+", "%2B").Replace("#", "%23").Replace("?", "%3F"); } } } \ No newline at end of file