-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can you support to delete a folder( not empty) ? #97
Comments
ErikZhou
changed the title
Can you supported to delete a folder( not empty) ?
Can you support to delete a folder( not empty) ?
Sep 29, 2020
There is a very easy way to extend this function.When I studied the source code, I found: func (s *HTTPStaticServer) hDelete(w http.ResponseWriter, req *http.Request) {
// only can delete file now
path := mux.Vars(req)["path"]
auth := s.readAccessConf(path)
if !auth.canDelete(req) {
http.Error(w, "Delete forbidden", http.StatusForbidden)
return
}
// Comment this line
// err := os.Remove(filepath.Join(s.Root, path))
err := os.RemoveAll(filepath.Join(s.Root, path))
if err != nil {
pathErr, ok := err.(*os.PathError)
if ok {
http.Error(w, pathErr.Op+" "+path+": "+pathErr.Err.Error(), 500)
} else {
http.Error(w, err.Error(), 500)
}
return
}
w.Write([]byte("Success"))
} The difference between |
hamburghammer
pushed a commit
to hamburghammer/gohttpserver
that referenced
this issue
Apr 1, 2021
Following features where merged: - Add support delete non-empty folder. - Add Cyan theme. - Sync status bar color with border-color on mobile platforms. There are also some other changes but I am not able to understand them from there commit message... * upstream/master: update readme merge pull request Fix the assignment of sync buf update docker badge Optimize the performance of the copy phase during the upload process support delete non-empty folder, close codeskyblue#97 update readme fix goreleaser again fix goreleaser again fix goreleaser fix upload large file >32M, close codeskyblue#98 Update travis.yml Edit README. Add Cyan theme. Sync status bar color with border-color on mobile platforms. Use Go 1.14 & Update copyright string. fix: 修复问题 fix: 修复问题 fix: issue#49
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks
The text was updated successfully, but these errors were encountered: