From 776062107b138557420ace9652b43175993c2efd Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Fri, 31 Jul 2020 21:15:36 -0600 Subject: [PATCH] Force upload file overwrite and remove un-needed TODO comments --- router/router_server_files.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/router/router_server_files.go b/router/router_server_files.go index 311703a..98c36b8 100644 --- a/router/router_server_files.go +++ b/router/router_server_files.go @@ -360,11 +360,9 @@ func postServerUploadFiles(c *gin.Context) { return } - // TODO: Make sure directory is safe. directory := c.Query("directory") for _, header := range headers { - // TODO: Make sure header#Filename is clean. p, err := s.Filesystem.SafePath(filepath.Join(directory, header.Filename)) if err != nil { c.AbortWithError(http.StatusInternalServerError, err) @@ -381,16 +379,6 @@ func postServerUploadFiles(c *gin.Context) { } func handleFileUpload(p string, s *server.Server, header *multipart.FileHeader) error { - _, err := s.Filesystem.Stat(header.Filename) - if err == nil { - // TODO: Figure out how to better handle this - - // This means the file exists, not 100% sure what to do in this situation, but for now we will skip the file. - return nil - } else if !os.IsNotExist(err) { - return errors.WithStack(err) - } - file, err := header.Open() if err != nil { return errors.WithStack(err)