😎调整Oops.Oh文件类型提示信息

This commit is contained in:
zuohuaijun 2025-06-09 12:18:25 +08:00
parent 7e1fee09c3
commit e584731e71
2 changed files with 3 additions and 3 deletions

View File

@ -530,9 +530,9 @@ public enum ErrorCodeEnum
D8000,
/// <summary>
/// 不允许的文件类型
/// 不允许的文件类型
/// </summary>
[ErrorCodeItemMetadata("不允许的文件类型")]
[ErrorCodeItemMetadata("不允许的文件类型{0}")]
D8001,
/// <summary>

View File

@ -258,7 +258,7 @@ public class SysFileService : IDynamicApiController, ITransient
}
// 验证文件类型
if (!_uploadOptions.ContentType.Contains(input.File.ContentType)) throw Oops.Oh($"{ErrorCodeEnum.D8001}:{input.File.ContentType}");
if (!_uploadOptions.ContentType.Contains(input.File.ContentType)) throw Oops.Oh(ErrorCodeEnum.D8001, input.File.ContentType);
// 验证文件大小
if (sizeKb > _uploadOptions.MaxSize) throw Oops.Oh($"{ErrorCodeEnum.D8002},允许最大:{_uploadOptions.MaxSize}KB");