From 29ed98d994b38b9f3200c65701ac4433a07bec01 Mon Sep 17 00:00:00 2001 From: k1LoW Date: Tue, 19 Mar 2024 14:04:54 +0900 Subject: [PATCH] Keep basePaths unmodified. --- paths/paths.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/paths/paths.go b/paths/paths.go index cf883c4..4888bdb 100644 --- a/paths/paths.go +++ b/paths/paths.go @@ -223,11 +223,11 @@ func checkPathAgainstBase(docPath, urlPath string, basePaths []string) bool { if docPath == urlPath { return true } - for i := range basePaths { - if basePaths[i][len(basePaths[i])-1] == '/' { - basePaths[i] = basePaths[i][:len(basePaths[i])-1] + for _, basePath := range basePaths { + if basePath[len(basePath)-1] == '/' { + basePath = basePath[:len(basePath)-1] } - merged := fmt.Sprintf("%s%s", basePaths[i], urlPath) + merged := fmt.Sprintf("%s%s", basePath, urlPath) if docPath == merged { return true }