dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 49f3d8849365fbf43c7697e2fea38d9d349116af
parent a0370271bfaa81f4187690fe15a9bc01966f4dde
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Tue, 31 Jan 2023 02:05:32 -0800

endpoint to quick check if we already have a chunk

Diffstat:
Mpkg/web/handlers/handlers.go | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -4417,6 +4417,17 @@ func FileDropTmpInitHandler(c echo.Context) error { func FileDropTmpHandler(c echo.Context) error { filedropUUID := c.Param("uuid") + { + fileName := c.Request().PostFormValue("fileName") + if fileName != "" { + if _, err := os.Stat(filepath.Join(config.Global.ProjectFiledropPath(), filedropUUID, fileName)); err != nil { + return c.NoContent(http.StatusOK) + } + // Let's use the teapot response (because why not) to say that we already have the file + return c.NoContent(http.StatusTeapot) + } + } + _, err := database.GetFiledropByUUID(filedropUUID) if err != nil { return c.Redirect(http.StatusFound, "/")