Bladeren bron

Pick #1536 into new framework

Him188 3 jaren geleden
bovenliggende
commit
115fdde78e
1 gewijzigde bestanden met toevoegingen van 14 en 3 verwijderingen
  1. 14 3
      mirai-core/src/commonMain/kotlin/network/message/OutgoingMessagePhasesCommon.kt

+ 14 - 3
mirai-core/src/commonMain/kotlin/network/message/OutgoingMessagePhasesCommon.kt

@@ -236,14 +236,25 @@ internal abstract class OutgoingMessagePhasesCommon {
              * Ensures server holds the cache
              * Ensures server holds the cache
              */
              */
             suspend fun GroupImpl.updateFriendImageForGroupMessage(image: FriendImage): OfflineGroupImage {
             suspend fun GroupImpl.updateFriendImageForGroupMessage(image: FriendImage): OfflineGroupImage {
+                // #1536
                 val response = ImgStore.GroupPicUp(
                 val response = ImgStore.GroupPicUp(
                     bot.client,
                     bot.client,
                     uin = bot.id,
                     uin = bot.id,
                     groupCode = id,
                     groupCode = id,
                     md5 = image.md5,
                     md5 = image.md5,
-                    size = if (image is OnlineFriendImageImpl) image.delegate.fileLen else 0
-                ).sendAndExpect(bot.network)
-                return OfflineGroupImage(image.imageId).also { img ->
+                    size = image.size
+                ).sendAndExpect(bot)
+                return OfflineGroupImage(
+                    imageId = image.imageId,
+                    width = image.width,
+                    height = image.height,
+                    size = if (response is ImgStore.GroupPicUp.Response.FileExists) {
+                        response.fileInfo.fileSize
+                    } else {
+                        image.size
+                    },
+                    imageType = image.imageType
+                ).also { img ->
                     when (response) {
                     when (response) {
                         is ImgStore.GroupPicUp.Response.FileExists -> {
                         is ImgStore.GroupPicUp.Response.FileExists -> {
                             img.fileId = response.fileId.toInt()
                             img.fileId = response.fileId.toInt()