dkforest

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

commit 4f1330ae09300da0af87ae07c319b5feb030d29c
parent aadf098e5675028853a140d6d60f0f89344524c8
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu, 26 Jan 2023 11:42:43 -0800

move code

Diffstat:
Mpkg/web/handlers/handlers.go | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -4205,17 +4205,18 @@ func FileDropHandler(c echo.Context) error { return c.Render(http.StatusOK, filedropTmplName, data) } - outFile, err := os.OpenFile(filepath.Join(database.FiledropFolder, filedrop.FileName), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) + encrypter, err := utils.EncryptStream(file) if err != nil { data.Error = err.Error() return c.Render(http.StatusOK, filedropTmplName, data) } - defer outFile.Close() - encrypter, err := utils.EncryptStream(file) + + outFile, err := os.OpenFile(filepath.Join(database.FiledropFolder, filedrop.FileName), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) if err != nil { data.Error = err.Error() return c.Render(http.StatusOK, filedropTmplName, data) } + defer outFile.Close() written, err := io.Copy(outFile, encrypter) if err != nil { data.Error = err.Error()