public virtual async Task <Stream> GetAsync(GetStaticFileInput input) { var ossObjectRequest = new GetOssObjectRequest( HttpUtility.UrlDecode(input.Bucket), // 需要处理特殊字符 HttpUtility.UrlDecode(input.Name), HttpUtility.UrlDecode(input.Path), HttpUtility.UrlDecode(input.Process)); var ossContainer = OssContainerFactory.Create(); var ossObject = await ossContainer.GetObjectAsync(ossObjectRequest); return(ossObject.Content); }
public virtual async Task <IActionResult> GetAsync(string bucket, string path, string name, string process) { var input = new GetStaticFileInput { Bucket = bucket, Name = name, Path = path, Process = process }; var fileStream = await _staticFilesAppServic.GetAsync(input); if (fileStream.IsNullOrEmpty()) { return(NotFound()); } return(File( fileStream, MimeTypes.GetByExtension(Path.GetExtension(input.Name)) )); }