From 4063215b0ad6997901f4e7342ef0b5f9b65f0cb0 Mon Sep 17 00:00:00 2001 From: YokiiroBW Date: Mon, 27 Jul 2026 03:28:34 +0800 Subject: [PATCH] fix(astrbot): let one rejected attachment path fall through to the next MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The candidate search returned on the first 401, so only the first of the three addresses was ever tried — the log shows ten requests to /api/chat/get_file and not a single download record. A rejection is per-endpoint here rather than per-connection. /api/chat/* is the dashboard's own API and wants a dashboard JWT, while /api/v1/* accepts the API key the connection already holds, so a 401 from one says nothing about the others. Co-Authored-By: Claude Opus 5 --- src-tauri/src/networking/astrbot_client.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/networking/astrbot_client.rs b/src-tauri/src/networking/astrbot_client.rs index 24f91a9..2ff2ab9 100644 --- a/src-tauri/src/networking/astrbot_client.rs +++ b/src-tauri/src/networking/astrbot_client.rs @@ -525,9 +525,11 @@ impl AstrBotClient { status = status.as_u16(), "astrbot attachment request" ); - if status.as_u16() == 401 || status.as_u16() == 403 { - return Err(AstrBotClientError::HttpStatus(status)); - } + // A rejection is per-endpoint, not per-connection: `/api/chat/*` is the + // dashboard's own API and wants a dashboard JWT, while `/api/v1/*` + // accepts the API key the connection already holds. Aborting the whole + // search on the first 401 meant the remaining candidates were never + // tried at all. if !status.is_success() { return Ok(Err(format!("HTTP {}", status.as_u16()))); }