commit 566b5575e22ff213da50a245898981fee8e41c5a
parent 81b89cdfc12788e73f5c06e221bafb3ef31bb508
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Tue, 31 Jan 2023 00:42:36 -0800
add calidation
Diffstat:
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -4310,6 +4310,12 @@ func FileDropHandler(c echo.Context) error {
func FileDropTmpReconstructHandler(c echo.Context) error {
filedropUUID := c.Param("uuid")
+
+ _, err := database.GetFiledropByUUID(filedropUUID)
+ if err != nil {
+ return c.Redirect(http.StatusFound, "/")
+ }
+
dirEntries, _ := os.ReadDir(filepath.Join(config.Global.ProjectFiledropPath(), filedropUUID))
fileNames := make([]string, 0)
for _, dirEntry := range dirEntries {
@@ -4369,6 +4375,12 @@ func FileDropTmpReconstructHandler(c echo.Context) error {
func FileDropTmpInitHandler(c echo.Context) error {
filedropUUID := c.Param("uuid")
+
+ _, err := database.GetFiledropByUUID(filedropUUID)
+ if err != nil {
+ return c.Redirect(http.StatusFound, "/")
+ }
+
if err := os.Mkdir(filepath.Join(config.Global.ProjectFiledropPath(), filedropUUID), 0755); err != nil {
logrus.Error(err)
return c.NoContent(http.StatusInternalServerError)
@@ -4386,6 +4398,12 @@ func FileDropTmpInitHandler(c echo.Context) error {
func FileDropTmpHandler(c echo.Context) error {
filedropUUID := c.Param("uuid")
+
+ _, err := database.GetFiledropByUUID(filedropUUID)
+ if err != nil {
+ return c.Redirect(http.StatusFound, "/")
+ }
+
file, handler, err := c.Request().FormFile("file")
if err != nil {
logrus.Error(err)