24 lines
483 B
Go
Executable File
24 lines
483 B
Go
Executable File
package server
|
|
|
|
import (
|
|
"fmt"
|
|
"gitea.inhome.blapointe.com/local/notes-server/filetree"
|
|
"net/http"
|
|
)
|
|
|
|
func (s *Server) edit(w http.ResponseWriter, r *http.Request) {
|
|
head(w, r)
|
|
editHead(w, filetree.NewPathFromURL(r.URL.Path))
|
|
edit, err := s.Notes.Edit(r.URL.Path)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
return
|
|
}
|
|
fmt.Fprintln(w, edit)
|
|
foot(w, r)
|
|
}
|
|
|
|
func editHead(w http.ResponseWriter, p filetree.Path) {
|
|
fmt.Fprintln(w, h2(p.MultiLink()))
|
|
}
|