From d6411d8b0d3469298d14ed6d383aa53c8f97ad53 Mon Sep 17 00:00:00 2001 From: oneRain Date: Thu, 23 Apr 2020 14:50:49 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=AE=8C=E5=96=84=20LCFileMessage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Realtime/Message/LCIMFileMessage.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Realtime/Message/LCIMFileMessage.cs b/Realtime/Message/LCIMFileMessage.cs index c06c38e..55aad4d 100644 --- a/Realtime/Message/LCIMFileMessage.cs +++ b/Realtime/Message/LCIMFileMessage.cs @@ -19,7 +19,10 @@ namespace LeanCloud.Realtime { public string Format { get { - return File.MimeType; + if (File.MetaData.TryGetValue("format", out object format)) { + return format as string; + } + return "unknown/unknown"; } } @@ -65,14 +68,14 @@ namespace LeanCloud.Realtime { Dictionary fileData = msgData["_lcfile"] as Dictionary; string objectId = fileData["objId"] as string; File = LCObject.CreateWithoutData(LCFile.CLASS_NAME, objectId) as LCFile; - if (fileData.TryGetValue("name", out object name)) { - File.Name = name as string; - } if (fileData.TryGetValue("url", out object url)) { File.Url = url as string; } if (fileData.TryGetValue("metaData", out object metaData)) { File.MetaData = metaData as Dictionary; + if (File.MetaData.TryGetValue("name", out object name)) { + File.Name = name as string; + } } } }