diff --git a/backend/browser/handlers.go b/backend/browser/handlers.go index 78400da..822a7e2 100644 --- a/backend/browser/handlers.go +++ b/backend/browser/handlers.go @@ -76,11 +76,11 @@ func Move(c *gin.Context) { func Delete(c *gin.Context) { path := getAbsolutePath(c.Param("path")) - err := os.Remove(path) + err := os.RemoveAll(path) if err != nil { log.Printf("Err: %s", err.Error()) c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{ - "err": "Couldn't move file", + "err": "Couldn't remove file", }) return } diff --git a/frontend/src/routes/directory/directory.js b/frontend/src/routes/directory/directory.js index d3997c6..900a7a7 100644 --- a/frontend/src/routes/directory/directory.js +++ b/frontend/src/routes/directory/directory.js @@ -37,7 +37,7 @@ const Directory = ({ dirPath = "" }) => { const [fileInfos, setFileInfos] = useState([]); const [searchQuery, setSearchQuery] = useState(""); const [compare, setCompare] = useState("name_asc"); - const [refresh, setRefresh] = useState(0); + const [refresh, setRefresh] = useState(0); // super hacky way to trigger effects useEffect(() => { if (dirPath != "" && !window.location.href.endsWith("/")) { @@ -128,7 +128,16 @@ const Directory = ({ dirPath = "" }) => { - + + setRefresh(refresh + 1)} + /> + setRefresh(refresh + 1)} + /> + ); } @@ -146,7 +155,7 @@ const Directory = ({ dirPath = "" }) => { setRefresh(refresh + 1)} // very hacky + refresh={() => setRefresh(refresh + 1)} />