Prechádzať zdrojové kódy

放大png q 的檔頭長度,避免超大型圖檔無法抓取檔頭抱錯

JAELYS 3 rokov pred
rodič
commit
65df364399

+ 2 - 2
TEAMModelOS.SDK/Extension/Utils.cs

@@ -103,8 +103,8 @@ namespace TEAMModelOS.SDK.Extension
         /// <returns></returns>
         public static (bool, string, int) ImageValidateByStream(Stream stream)
         {
-            int length = 1024;
-            byte[] bytes = new byte[1024];
+            int length = 10240;
+            byte[] bytes = new byte[length];
             BinaryReader br = new BinaryReader(stream);
             StringBuilder stringBuilder = new StringBuilder();
             for (int i = 0; i < length; i++)

+ 1 - 0
TEAMModelOS/Controllers/Core/CoreController.cs

@@ -135,6 +135,7 @@ namespace TEAMModelOS.Controllers.Core
                             img = $"{Guid.NewGuid():N}.{type}"; //命名新圖片名稱
                             string Container = item.blob.Substring(0, item.blob.IndexOf("/")); //取得容器名稱
                             string blobpath = $"{item.blob[(item.blob.Trim('/').IndexOf("/") + 1)..]}/{img}"; //處理路徑,避免多餘的字符
+                            obase64ms.Position = 0;
                             await _azureStorage.GetBlobContainerClient(Container).GetBlobClient(blobpath).UploadAsync(obase64ms, new BlobHttpHeaders { ContentType = otype });
                         }
                         using var nbase64ms = new MemoryStream();