controller name cannot contain '-', plugin packages are in 'controller/plugin-path-dash-separated/main.go' + root is '/controller/ROOT/main.go'
This commit is contained in:
parent
9808dd6de4
commit
e5f7cf1147
|
@ -210,8 +210,8 @@ func (c *Controller) format(controllerName string) error {
|
|||
for ctlName, ctl := range c.Children {
|
||||
|
||||
/* (3) Invalid name */
|
||||
if strings.Contains(ctlName, "/") {
|
||||
return fmt.Errorf("Controller '%s' must not contain any slash '/'", ctlName)
|
||||
if strings.ContainsAny(ctlName, "/-") {
|
||||
return fmt.Errorf("Controller '%s' must not contain any slash '/' nor '-' symbols", ctlName)
|
||||
}
|
||||
|
||||
/* (4) Check recursively */
|
||||
|
|
|
@ -96,7 +96,12 @@ func FetchFormData(req *http.Request) map[string]interface{} {
|
|||
func (i *Request) LoadController(method string) (func(implement.Arguments, *implement.Response) implement.Response, error) {
|
||||
|
||||
/* (1) Build controller path */
|
||||
path := fmt.Sprintf(".build/controller/%s/i.so", strings.Join(i.Path, "/"))
|
||||
path := strings.Join(i.Path, "-")
|
||||
if len(path) == 0 {
|
||||
path = fmt.Sprintf(".build/controller/ROOT/main.so")
|
||||
} else {
|
||||
path = fmt.Sprintf(".build/controller/%s/main.so", path)
|
||||
}
|
||||
|
||||
/* (2) Format url */
|
||||
tmp := []byte(strings.ToLower(method))
|
||||
|
|
Loading…
Reference in New Issue