WebClient: do not silently overwrite files/directories

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2023-12-28 18:43:07 +01:00
parent e35e07acdb
commit 3121c35437
20 changed files with 564 additions and 90 deletions

View File

@@ -20,6 +20,7 @@ import (
"net/http"
"strings"
"github.com/go-chi/render"
"github.com/unrolled/secure"
"github.com/drakkan/sftpgo/v2/internal/util"
@@ -148,3 +149,8 @@ func getI18NErrorString(err error, fallback string) string {
}
return fallback
}
func handlePingRequest(w http.ResponseWriter, r *http.Request) {
r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)
render.PlainText(w, r, "PONG")
}