From e4db7e8510e1ffa83124a35cfdeb30f8e297dc65 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Wed, 6 Jul 2022 11:25:46 +0800 Subject: [PATCH] Support access branch that contains slash character Resolve #101 --- server/handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/handler.go b/server/handler.go index 3a2667d..11da0a5 100644 --- a/server/handler.go +++ b/server/handler.go @@ -89,6 +89,10 @@ func Handler(mainDomainSuffix, rawDomain []byte, return false } + // Replace "~" to "/" so we can access branch that contains slash character + // Branch name cannot contain "~" so doing this is okay + branch = strings.ReplaceAll(branch, "~", "/") + // Check if the branch exists, otherwise treat it as a file path branchTimestampResult := upstream.GetBranchTimestamp(giteaClient, targetOwner, repo, branch, branchTimestampCache) if branchTimestampResult == nil {