[fix] sui page remove api
This commit is contained in:
parent
b81e4f2003
commit
b2f0f9e5e9
2 changed files with 6 additions and 0 deletions
|
|
@ -583,6 +583,10 @@ func PageRemove(process *process.Process) interface{} {
|
|||
exception.New(err.Error(), 500).Throw()
|
||||
}
|
||||
|
||||
if !tmpl.PageExist(route) {
|
||||
exception.New("page does not exists!", 400).Throw()
|
||||
}
|
||||
|
||||
err = tmpl.RemovePage(route)
|
||||
if err != nil {
|
||||
exception.New(err.Error(), 500).Throw()
|
||||
|
|
|
|||
|
|
@ -186,6 +186,8 @@ func (tmpl *Template) RemovePage(route string) error {
|
|||
|
||||
path := filepath.Join(tmpl.Root, route)
|
||||
name := filepath.Base(path) + ".*"
|
||||
name = strings.ReplaceAll(name, "[", "\\[")
|
||||
name = strings.ReplaceAll(name, "]", "\\]")
|
||||
err := tmpl.local.fs.Walk(path, func(root, file string, isdir bool) error {
|
||||
if isdir {
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue