From 16846aefd3382e954434ae7cc559a88329466699 Mon Sep 17 00:00:00 2001 From: wonfen Date: Wed, 23 Apr 2025 00:42:57 +0800 Subject: [PATCH] feat: allow webdav directory redirect --- UPDATELOG.md | 1 + src-tauri/src/core/backup.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/UPDATELOG.md b/UPDATELOG.md index 4f2334b7..7a8d2308 100644 --- a/UPDATELOG.md +++ b/UPDATELOG.md @@ -21,6 +21,7 @@ - 关闭系统代理时关闭已建立的网络连接 - 托盘显示当前轻量模式状态 - Webdav 请求加入 UA + - Webdav 支持目录重定向 #### 优化了: - 系统代理 Bypass 设置 diff --git a/src-tauri/src/core/backup.rs b/src-tauri/src/core/backup.rs index 41d38c2c..4540651b 100644 --- a/src-tauri/src/core/backup.rs +++ b/src-tauri/src/core/backup.rs @@ -112,6 +112,14 @@ impl WebDavClient { "clash-verge/{} ({} WebDAV-Client)", APP_VERSION, OS )) + .redirect(reqwest::redirect::Policy::custom(|attempt| { + // 允许所有请求类型的重定向,包括PUT + if attempt.previous().len() >= 5 { + attempt.error("重定向次数过多") + } else { + attempt.follow() + } + })) .build() .unwrap(), )