Don't expect double-encoded values here

This commit is contained in:
Dane Everitt 2020-12-08 21:24:31 -08:00
parent 04d714f19c
commit 73f1399e47
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -22,14 +22,7 @@ import (
// Returns the contents of a file on the server. // Returns the contents of a file on the server.
func getServerFileContents(c *gin.Context) { func getServerFileContents(c *gin.Context) {
s := GetServer(c.Param("server")) s := GetServer(c.Param("server"))
p := "/" + strings.TrimLeft(c.Query("file"), "/")
p, err := url.QueryUnescape(c.Query("file"))
if err != nil {
TrackedServerError(err, s).AbortWithServerError(c)
return
}
p = "/" + strings.TrimLeft(p, "/")
st, err := s.Filesystem().Stat(p) st, err := s.Filesystem().Stat(p)
if err != nil { if err != nil {
TrackedServerError(err, s).AbortFilesystemError(c) TrackedServerError(err, s).AbortFilesystemError(c)
@ -65,13 +58,7 @@ func getServerFileContents(c *gin.Context) {
func getServerListDirectory(c *gin.Context) { func getServerListDirectory(c *gin.Context) {
s := GetServer(c.Param("server")) s := GetServer(c.Param("server"))
d, err := url.QueryUnescape(c.Query("directory")) stats, err := s.Filesystem().ListDirectory(c.Query("directory"))
if err != nil {
TrackedServerError(err, s).AbortWithServerError(c)
return
}
stats, err := s.Filesystem().ListDirectory(d)
if err != nil { if err != nil {
TrackedServerError(err, s).AbortFilesystemError(c) TrackedServerError(err, s).AbortFilesystemError(c)
return return