diff --git a/sui/api/process.go b/sui/api/process.go index db435dcc..6aadf3e7 100644 --- a/sui/api/process.go +++ b/sui/api/process.go @@ -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() diff --git a/sui/storages/local/page.go b/sui/storages/local/page.go index 390cfbdc..3de35b80 100644 --- a/sui/storages/local/page.go +++ b/sui/storages/local/page.go @@ -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