From 73f1399e476fc11cf5c8b81ca94c55e7085ea684 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Tue, 8 Dec 2020 21:24:31 -0800 Subject: [PATCH] Don't expect double-encoded values here --- router/router_server_files.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/router/router_server_files.go b/router/router_server_files.go index 419e66b..b6ea657 100644 --- a/router/router_server_files.go +++ b/router/router_server_files.go @@ -22,14 +22,7 @@ import ( // Returns the contents of a file on the server. func getServerFileContents(c *gin.Context) { s := GetServer(c.Param("server")) - - p, err := url.QueryUnescape(c.Query("file")) - if err != nil { - TrackedServerError(err, s).AbortWithServerError(c) - return - } - p = "/" + strings.TrimLeft(p, "/") - + p := "/" + strings.TrimLeft(c.Query("file"), "/") st, err := s.Filesystem().Stat(p) if err != nil { TrackedServerError(err, s).AbortFilesystemError(c) @@ -65,13 +58,7 @@ func getServerFileContents(c *gin.Context) { func getServerListDirectory(c *gin.Context) { s := GetServer(c.Param("server")) - d, err := url.QueryUnescape(c.Query("directory")) - if err != nil { - TrackedServerError(err, s).AbortWithServerError(c) - return - } - - stats, err := s.Filesystem().ListDirectory(d) + stats, err := s.Filesystem().ListDirectory(c.Query("directory")) if err != nil { TrackedServerError(err, s).AbortFilesystemError(c) return