From f8a5999d36fda0574e9f7a11a644a491889ab437 Mon Sep 17 00:00:00 2001 From: wood chen Date: Sun, 12 Jan 2025 18:14:27 +0800 Subject: [PATCH] fix(utils): update default size threshold and enhance logging for extension mapping --- internal/utils/utils.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/utils/utils.go b/internal/utils/utils.go index e894b11..2161caa 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -156,10 +156,10 @@ func GetTargetURL(client *http.Client, r *http.Request, pathConfig config.PathCo // 默认使用默认目标 targetBase := pathConfig.DefaultTarget - // 如果没有设置阈值,使用默认值 200KB + // 如果没有设置阈值,使用默认值 500KB threshold := pathConfig.SizeThreshold if threshold <= 0 { - threshold = 200 * 1024 + threshold = 500 * 1024 } // 检查文件扩展名 @@ -200,8 +200,17 @@ func GetTargetURL(client *http.Client, r *http.Request, pathConfig config.PathCo log.Printf("[Route] %s -> %s (size: %s <= %s)", path, targetBase, FormatBytes(contentLength), FormatBytes(threshold)) } + } else { + // 记录没有匹配扩展名映射的情况 + log.Printf("[Route] %s -> %s (no extension mapping)", path, targetBase) } + } else { + // 记录没有扩展名的情况 + log.Printf("[Route] %s -> %s (no extension)", path, targetBase) } + } else { + // 记录没有扩展名映射配置的情况 + log.Printf("[Route] %s -> %s (no extension map)", path, targetBase) } return targetBase