diff --git a/projects/Infrastructure/Web/Mvc/FileController.cs b/projects/Infrastructure/Web/Mvc/FileController.cs index 8de53852..efb3d1ee 100644 --- a/projects/Infrastructure/Web/Mvc/FileController.cs +++ b/projects/Infrastructure/Web/Mvc/FileController.cs @@ -2,15 +2,16 @@ using Infrastructure.Extensions; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.StaticFiles; using Microsoft.Extensions.Configuration; using Minio; using System; +using System.Collections.Generic; using System.Globalization; using System.IO; using System.IO.Compression; using System.Net.Http; using System.Security.Cryptography; -using System.Collections.Generic; namespace Infrastructure.Web.Mvc { @@ -96,9 +97,9 @@ namespace Infrastructure.Web.Mvc private string UploadMinIO(IFormFile file) { using var stream = file.OpenReadStream(); - var ext = GetExtension(file.FileName); + var ext = Path.GetExtension(file.FileName); var md5 = GetFileNameHash(stream); - var name = $"{md5}.{ext}"; + var name = $"{md5}{ext}"; var endpoint = this._cfg["minio:endpoint"]; var accessKey = this._cfg["minio:accessKey"]; var secretKey = this._cfg["minio:secretKey"]; @@ -139,7 +140,8 @@ namespace Infrastructure.Web.Mvc { ex.PrintStack(); stream.Position = 0; - minio.PutObjectAsync(bucketName, name, stream, stream.Length); + new FileExtensionContentTypeProvider().Mappings.TryGetValue(ext, out string contenttype); + minio.PutObjectAsync(bucketName, name, stream, stream.Length, contenttype); } var path = $"/{bucketName}/{name}"; return $"/dfs{path}"; diff --git a/projects/WebMVC/wwwroot/components/shared/edit/html.html b/projects/WebMVC/wwwroot/components/shared/edit/html.html index 445e5693..7800035b 100644 --- a/projects/WebMVC/wwwroot/components/shared/edit/html.html +++ b/projects/WebMVC/wwwroot/components/shared/edit/html.html @@ -16,7 +16,10 @@ width: '100%', allowImageUpload: true, uploadJson: vm.uploadUrl, - formatUploadUrl: false + formatUploadUrl: false, + afterChange: function () { + vm.$emit('update:value', this.html()); + } }); }, computed: { diff --git a/projects/WebMVC/wwwroot/components/shared/layout.html b/projects/WebMVC/wwwroot/components/shared/layout.html index 48dacca5..b77715ca 100644 --- a/projects/WebMVC/wwwroot/components/shared/layout.html +++ b/projects/WebMVC/wwwroot/components/shared/layout.html @@ -31,7 +31,7 @@