diff --git a/CoreCms.Net.Services/Shop/CoreCmsSettingServices.cs b/CoreCms.Net.Services/Shop/CoreCmsSettingServices.cs
index f64ccc60..510f59d2 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.Path = UpLoadHelper.PathFormat(filesStorageOptions.StorageType, filesStorageOptions.Path, filesStorageOptions.BucketBindUrl);
return filesStorageOptions;
diff --git a/CoreCms.Net.Utility/Helper/UpLoadHelper.cs b/CoreCms.Net.Utility/Helper/UpLoadHelper.cs
index 41b36f90..7befe7b1 100644
--- a/CoreCms.Net.Utility/Helper/UpLoadHelper.cs
+++ b/CoreCms.Net.Utility/Helper/UpLoadHelper.cs
@@ -23,24 +23,34 @@ namespace CoreCms.Net.Utility.Helper
///
/// 上传类型
/// 原始路径
+ /// 地址
///
- public static string PathFormat(string storageType, string oldFilePath)
+ public static string PathFormat(string storageType, string oldFilePath, string bucketBindUrl)
{
string newPath;
- switch (storageType)
+ //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("/"))
{
- 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 = oldFilePath.StartsWith("/") ? oldFilePath[1..] : oldFilePath;
+ }
+ else
+ {
+ newPath = oldFilePath.StartsWith("/") ? oldFilePath : "/" + oldFilePath;
}
newPath = newPath.EndsWith("/") ? newPath : newPath + "/";
return newPath;