notes-server/notes/create.go

16 lines
309 B
Go
Executable File

package notes
import (
"errors"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"path"
)
func (n *Notes) Create(urlPath string) (string, error) {
p := filetree.NewPathFromURL(urlPath)
if p.IsDir() {
return "", errors.New("directory exists")
}
return path.Join("/edit/", p.BaseHREF), nil
}