From 9959150bc186b910413ee38e7240874f2a91cf46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=81=B0=E7=81=B0?= Date: Wed, 28 Dec 2022 16:06:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=9C=AC=E5=9C=B0=E4=B8=8A=E4=BC=A0=E5=86=99=E5=85=A5?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E7=BC=BA=E5=B0=91=E5=8F=8D=E6=96=9C?= =?UTF-8?q?=E6=9D=A0=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Shop/CoreCmsSettingServices.cs | 2 +- CoreCms.Net.Utility/Helper/UpLoadHelper.cs | 38 +++++++------------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/CoreCms.Net.Services/Shop/CoreCmsSettingServices.cs b/CoreCms.Net.Services/Shop/CoreCmsSettingServices.cs index 510f59d2..f64ccc60 100644 --- a/CoreCms.Net.Services/Shop/CoreCmsSettingServices.cs +++ b/CoreCms.Net.Services/Shop/CoreCmsSettingServices.cs @@ -196,7 +196,7 @@ namespace CoreCms.Net.Services filesStorageOptions.QiNiuBucketName = GetValue(SystemSettingConstVars.FilesStorageQiNiuBucketName, configs, settings); //格式化存储文件夹路径 - filesStorageOptions.Path = UpLoadHelper.PathFormat(filesStorageOptions.StorageType, filesStorageOptions.Path, filesStorageOptions.BucketBindUrl); + filesStorageOptions.Path = UpLoadHelper.PathFormat(filesStorageOptions.StorageType, filesStorageOptions.Path); return filesStorageOptions; diff --git a/CoreCms.Net.Utility/Helper/UpLoadHelper.cs b/CoreCms.Net.Utility/Helper/UpLoadHelper.cs index 7befe7b1..41b36f90 100644 --- a/CoreCms.Net.Utility/Helper/UpLoadHelper.cs +++ b/CoreCms.Net.Utility/Helper/UpLoadHelper.cs @@ -23,34 +23,24 @@ namespace CoreCms.Net.Utility.Helper /// /// 上传类型 /// 原始路径 - /// 地址 /// - public static string PathFormat(string storageType, string oldFilePath, string bucketBindUrl) + public static string PathFormat(string storageType, string oldFilePath) { string newPath; - //switch (storageType) - //{ - // case "LocalStorage": - // newPath = oldFilePath.StartsWith("/") ? oldFilePath : "/" + oldFilePath; - // break; - // case "AliYunOSS": - // newPath = oldFilePath.StartsWith("/") ? oldFilePath.Substring(1) : oldFilePath; - // break; - // case "QCloudOSS": - // newPath = oldFilePath.StartsWith("/") ? oldFilePath.Substring(1) : oldFilePath; - // break; - // default: - // newPath = "/upload/"; - // break; - //} - - if (bucketBindUrl.EndsWith("/")) + switch (storageType) { - newPath = oldFilePath.StartsWith("/") ? oldFilePath[1..] : oldFilePath; - } - else - { - newPath = oldFilePath.StartsWith("/") ? oldFilePath : "/" + oldFilePath; + case "LocalStorage": + newPath = oldFilePath.StartsWith("/") ? oldFilePath : "/" + oldFilePath; + break; + case "AliYunOSS": + newPath = oldFilePath.StartsWith("/") ? oldFilePath.Substring(1) : oldFilePath; + break; + case "QCloudOSS": + newPath = oldFilePath.StartsWith("/") ? oldFilePath.Substring(1) : oldFilePath; + break; + default: + newPath = "/upload/"; + break; } newPath = newPath.EndsWith("/") ? newPath : newPath + "/"; return newPath;