You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
updates
This commit is contained in:
27
edit/edit.go
Normal file
27
edit/edit.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package edit
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
}
|
||||
|
||||
// Execute sth
|
||||
func Execute(w http.ResponseWriter, r *http.Request, file string) (int, error) {
|
||||
if r.Method == "POST" {
|
||||
// it's saving the post
|
||||
} else {
|
||||
// check if the file exists
|
||||
if _, err := os.Stat(file); os.IsNotExist(err) {
|
||||
return 404, nil
|
||||
}
|
||||
|
||||
file, _ := ioutil.ReadFile(file)
|
||||
w.Write([]byte(string(file)))
|
||||
}
|
||||
|
||||
return 200, nil
|
||||
}
|
||||
Reference in New Issue
Block a user