mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:33:27 +08:00
【优化】优化【平台设置/附件设置】域名结尾不加“/”,upload起始位加“/”,导致路径有误的问题。
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -23,24 +23,34 @@ namespace CoreCms.Net.Utility.Helper
|
||||
/// </summary>
|
||||
/// <param name="storageType">上传类型</param>
|
||||
/// <param name="oldFilePath">原始路径</param>
|
||||
/// <param name="bucketBindUrl">地址</param>
|
||||
/// <returns></returns>
|
||||
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("/"))
|
||||
{
|
||||
newPath = oldFilePath.StartsWith("/") ? oldFilePath[1..] : oldFilePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user