Use Base64Url form for paths. (#556)

This commit is contained in:
Zoe Roux
2024-06-30 16:02:38 +07:00
committed by GitHub
parent 5b8cebfc21
commit df8b5658a7
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -24,9 +24,9 @@ func GetPath(c echo.Context) (string, string, error) {
if key == "" {
return "", "", echo.NewHTTPError(http.StatusBadRequest, "Missing resouce path.")
}
pathb, err := base64.StdEncoding.DecodeString(key)
pathb, err := base64.RawURLEncoding.DecodeString(key)
if err != nil {
return "", "", echo.NewHTTPError(http.StatusBadRequest, "Invalid path. Should be base64 encoded.")
return "", "", echo.NewHTTPError(http.StatusBadRequest, "Invalid path. Should be base64url (without padding) encoded.")
}
path := filepath.Clean(string(pathb))
if !filepath.IsAbs(path) {