😎禁止上传无后缀文件
This commit is contained in:
parent
e584731e71
commit
406fca1ef8
@ -264,9 +264,9 @@ public class SysFileService : IDynamicApiController, ITransient
|
||||
if (sizeKb > _uploadOptions.MaxSize) throw Oops.Oh($"{ErrorCodeEnum.D8002},允许最大:{_uploadOptions.MaxSize}KB");
|
||||
|
||||
// 获取文件后缀
|
||||
var suffix = Path.GetExtension(input.File.FileName).ToLower(); // 后缀
|
||||
if (string.IsNullOrWhiteSpace(suffix))
|
||||
suffix = string.Concat(".", input.File.ContentType.AsSpan(input.File.ContentType.LastIndexOf('/') + 1));
|
||||
var suffix = Path.GetExtension(input.File.FileName).ToLower();
|
||||
if (string.IsNullOrWhiteSpace(suffix)) throw Oops.Oh(ErrorCodeEnum.D8003);
|
||||
//suffix = string.Concat(".", input.File.ContentType.AsSpan(input.File.ContentType.LastIndexOf('/') + 1));
|
||||
if (!string.IsNullOrWhiteSpace(suffix))
|
||||
{
|
||||
//var contentTypeProvider = FS.GetFileExtensionContentTypeProvider();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user