From 174ca300d6829d155e00a3a92ea0e5033e2e7abd Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 27 Mar 2021 15:39:46 +0800 Subject: [PATCH 1/2] Fix empty listFiles for child directories, fix #1118 --- mirai-core/src/commonMain/kotlin/utils/RemoteFileImpl.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/utils/RemoteFileImpl.kt b/mirai-core/src/commonMain/kotlin/utils/RemoteFileImpl.kt index 265cce8dc..eb4e7f0d4 100644 --- a/mirai-core/src/commonMain/kotlin/utils/RemoteFileImpl.kt +++ b/mirai-core/src/commonMain/kotlin/utils/RemoteFileImpl.kt @@ -91,7 +91,7 @@ internal class RemoteFileInfo( ) { companion object { val root = RemoteFileInfo( - "", false, "/", "/", "", 0, 0, 0, 0, 0, 0, EMPTY_BYTE_ARRAY, EMPTY_BYTE_ARRAY + "/", false, "/", "/", "", 0, 0, 0, 0, 0, 0, EMPTY_BYTE_ARRAY, EMPTY_BYTE_ARRAY ) } } @@ -211,14 +211,16 @@ internal class RemoteFileImpl( } } - private fun getFilesFlow(): Flow { + private suspend fun getFilesFlow(): Flow { + val info = getFileFolderInfo() ?: return emptyFlow() + return flow { var index = 0 while (true) { val list = FileManagement.GetFileList( client, groupCode = contact.id, - folderId = path, + folderId = info.id, startIndex = index ).sendAndExpect(bot).toResult("RemoteFile.listFiles").getOrThrow() index += list.itemList.size From c8e0eccf67f88688c6e455f8f99d12dabf3f2f93 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 27 Mar 2021 15:41:09 +0800 Subject: [PATCH 2/2] 2.5.1-dev-1 --- buildSrc/src/main/kotlin/Versions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 8203dbef2..8c6092dfe 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -12,7 +12,7 @@ import org.gradle.api.attributes.Attribute object Versions { - const val project = "2.5.0" + const val project = "2.5.1-dev-1" const val core = project const val console = project