aboutsummaryrefslogtreecommitdiffstats
path: root/modules/public
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-03-08 20:17:39 +0800
committerGitHub <noreply@github.com>2023-03-08 20:17:39 +0800
commitb116418f05b822481bba3613873eef876da73814 (patch)
tree65d1d88d940c26029e7ef920c4dd30761763ce46 /modules/public
parent090e75392385041b3abb30d02564962a3ff687f6 (diff)
downloadgitea-b116418f05b822481bba3613873eef876da73814.tar.gz
gitea-b116418f05b822481bba3613873eef876da73814.zip
Use CleanPath instead of path.Clean (#23371)
As title.
Diffstat (limited to 'modules/public')
-rw-r--r--modules/public/public.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/public/public.go b/modules/public/public.go
index 42026f9b10..e1d60d89eb 100644
--- a/modules/public/public.go
+++ b/modules/public/public.go
@@ -6,7 +6,6 @@ package public
import (
"net/http"
"os"
- "path"
"path/filepath"
"strings"
@@ -14,6 +13,7 @@ import (
"code.gitea.io/gitea/modules/httpcache"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/util"
)
// Options represents the available options to configure the handler.
@@ -103,7 +103,7 @@ func setWellKnownContentType(w http.ResponseWriter, file string) {
func (opts *Options) handle(w http.ResponseWriter, req *http.Request, fs http.FileSystem, file string) bool {
// use clean to keep the file is a valid path with no . or ..
- f, err := fs.Open(path.Clean(file))
+ f, err := fs.Open(util.CleanPath(file))
if err != nil {
if os.IsNotExist(err) {
return false