file not exists: /tx-fs-disk/e005aed8-a488-4b17-95c7-9756a70259ff/4d5cfe46-9694-49c7-ba80-206f402f395c
java.lang.IllegalStateException: file not exists: /tx-fs-disk/e005aed8-a488-4b17-95c7-9756a70259ff/4d5cfe46-9694-49c7-ba80-206f402f395c
at net.mamoe.mirai.mock.internal.serverfs.MockServerFileImpl.asExternalResource(MockServerFileDiskImpl.kt:290)
at net.mamoe.mirai.mock.internal.remotefile.absolutefile.MockAbsoluteFolderKt.toMockAbsFile(MockAbsoluteFolder.kt:51)
at net.mamoe.mirai.mock.internal.remotefile.absolutefile.MockAbsoluteFolderKt.toMockAbsFile$default(MockAbsoluteFolder.kt:44)
at net.mamoe.mirai.mock.internal.remotefile.absolutefile.MockAbsoluteFolder$resolveFiles$2.invoke(MockAbsoluteFolder.kt:167)
at net.mamoe.mirai.mock.internal.remotefile.absolutefile.MockAbsoluteFolder$resolveFiles$2.invoke(MockAbsoluteFolder.kt:166)
mockUploadAudio 报错 RandomAccessFile.inputStream cannot be opened simultaneously., 期待继续上传
原因应该是 net.mamoe.mirai.mock.internal.contact.UtilKt#mockUploadAudio 里的 inResource 调用, 把这个换成 run 之类的就没问题, 可能是里面的 runBIO 和外面的 md5 里面调用 inputStream 冲突/竞争了
RandomAccessFile.inputStream cannot be opened simultaneously.
java.lang.IllegalStateException: RandomAccessFile.inputStream cannot be opened simultaneously.
at net.mamoe.mirai.internal.utils.ExternalResourceImplByFile.inputStream(ExternalResourceImpls.kt:137)
at net.mamoe.mirai.internal.utils.ExternalResourceImplByFile$md5$2.invoke(ExternalResourceImpls.kt:130)
at net.mamoe.mirai.internal.utils.ExternalResourceImplByFile$md5$2.invoke(ExternalResourceImpls.kt:130)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at net.mamoe.mirai.internal.utils.ExternalResourceImplByFile.getMd5(ExternalResourceImpls.kt:130)
at net.mamoe.mirai.mock.internal.contact.UtilKt.mockUploadAudio(util.kt:55)
问题描述
resolveFiles
在目标路径没有文件只有文件夹的时候(比如resolveFiles("/a")
但是根目录下只有一个a的文件夹而没有叫a的文件)报错file not exists:
, 期待返回空 flow 我觉得应该在net.mamoe.mirai.mock.internal.remotefile.absolutefile.MockAbsoluteFolder#resolveFiles
里的第4行添加一个filter{ isFile }
来解决这个问题, 报错是在这个 map 里面的toMockAbsFile
抛出mockUploadAudio
报错RandomAccessFile.inputStream cannot be opened simultaneously.
, 期待继续上传 原因应该是net.mamoe.mirai.mock.internal.contact.UtilKt#mockUploadAudio
里的inResource
调用, 把这个换成run
之类的就没问题, 可能是里面的runBIO
和外面的 md5 里面调用inputStream
冲突/竞争了复现
复制以下复现代码到
mirai-core-mock/test/AbsoluteFileTest.kt
mirai-core 版本
2.15.0
bot-protocol
ANDROID_PHONE
其他组件版本
No response
系统日志
No response
网络日志
No response
补充信息
No response