mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:43:26 +08:00
【优化】优化本地上传写入文件夹缺少反斜杠的问题。
This commit is contained in:
@@ -196,7 +196,7 @@ namespace CoreCms.Net.Services
|
|||||||
filesStorageOptions.QiNiuBucketName = GetValue(SystemSettingConstVars.FilesStorageQiNiuBucketName, configs, settings);
|
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;
|
return filesStorageOptions;
|
||||||
|
|||||||
@@ -23,34 +23,24 @@ namespace CoreCms.Net.Utility.Helper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="storageType">上传类型</param>
|
/// <param name="storageType">上传类型</param>
|
||||||
/// <param name="oldFilePath">原始路径</param>
|
/// <param name="oldFilePath">原始路径</param>
|
||||||
/// <param name="bucketBindUrl">地址</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string PathFormat(string storageType, string oldFilePath, string bucketBindUrl)
|
public static string PathFormat(string storageType, string oldFilePath)
|
||||||
{
|
{
|
||||||
string newPath;
|
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;
|
case "LocalStorage":
|
||||||
}
|
newPath = oldFilePath.StartsWith("/") ? oldFilePath : "/" + oldFilePath;
|
||||||
else
|
break;
|
||||||
{
|
case "AliYunOSS":
|
||||||
newPath = oldFilePath.StartsWith("/") ? oldFilePath : "/" + oldFilePath;
|
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 + "/";
|
newPath = newPath.EndsWith("/") ? newPath : newPath + "/";
|
||||||
return newPath;
|
return newPath;
|
||||||
|
|||||||
Reference in New Issue
Block a user