Closed areCodeOI closed 1 year ago
检查下上传的参数中是不是缺少了 img
检查下上传的参数中是不是缺少了
img
img?
检查下上传的参数中是不是缺少了
img
我是按照这里 https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#%E8%AF%AD%E9%9F%B3%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0 来的,/file/upload 上传文件,用的PHPcurl进行接口的调用
file
参数是不是缺了
file
参数是不是缺了
没有,我是new curlfile来传的理论上应该没错。。。
方便的话提供下代码,直接复现一下
方便的话提供下代码,直接复现一下
$result = json_decode($requests->upload($this->mirai->host.'/file/upload', [ 'sessionKey'=>$this->mirai->getsessionKey(), 'type'=>'group', 'target'=>$this->list[0], 'path'=>'test.php',//trim($path, '/'), 'file'=>new \curlfile(realpath('文件')) ])->result, true);
2022-12-11 14:21:08 E/MAH Access: java.lang.IllegalAccessException: 未知错误 java.lang.IllegalAccessException: 未知错误 at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.router.FileKt$fileRouter$1$invoke$$inlined$httpAuthedMultiPart$1$1.invokeSuspend(dsl.kt:224) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.router.FileKt$fileRouter$1$invoke$$inlined$httpAuthedMultiPart$1$1.invoke(dsl.kt) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.router.FileKt$fileRouter$1$invoke$$inlined$httpAuthedMultiPart$1$1.invoke(dsl.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:78) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing.executeResult(Routing.kt:155) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing.interceptor(Routing.kt:39) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:107) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.auth.Authorization$install$1.invokeSuspend(Authorization.kt:41) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.auth.Authorization$install$1.invoke(Authorization.kt) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.auth.Authorization$install$1.invoke(Authorization.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature. at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:78) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing.executeResult(Routing.kt:155) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing.interceptor(Routing.kt:39) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:107) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.auth.Authorization$install$1.invokeSuspend(Authorization.kt:41) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.auth.Authorization$install$1.invoke(Authorization.kt) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.auth.Authorization$install$1.invoke(Authorization.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.handler.HttpRouterAccessHandler.intercept(HttpRouterAccessHandler.kt:36) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.handler.HttpRouterAccessHandler.access$intercept(HttpRouterAccessHandler.kt:25) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.handler.HttpRouterAccessHandler$Feature$install$1.invokeSuspend(HttpRouterAccessHandler.kt:91) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.handler.HttpRouterAccessHandler$Feature$install$1.invoke(HttpRouterAccessHandler.kt) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.handler.HttpRouterAccessHandler$Feature$install$1.invoke(HttpRouterAccessHandler.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:78) at mirai-api-http-2.6.2.jar[shared]//io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invokeSuspend(DefaultEnginePipeline.kt:127) at mirai-api-http-2.6.2.jar[shared]//io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:78) at mirai-api-http-2.6.2.jar[shared]//io.ktor.server.cio.CIOApplicationEngine$handleRequest$2.invokeSuspend(CIOApplicationEngine.kt:196) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)