|
@@ -204,7 +204,8 @@ func (g *Gateway) InterfaceHandler(w http.ResponseWriter, r *http.Request, thisu
|
|
|
//Get the script files for the plugin
|
|
|
scriptFile, err := utils.GetPara(r, "script")
|
|
|
if err != nil {
|
|
|
- utils.SendErrorResponse(w, "Invalid script path")
|
|
|
+ w.WriteHeader(http.StatusInternalServerError)
|
|
|
+ w.Write([]byte("500 - Internal Server Error: Invalid script path"))
|
|
|
return
|
|
|
}
|
|
|
scriptFile = static.SpecialURIDecode(scriptFile)
|
|
@@ -223,7 +224,8 @@ func (g *Gateway) InterfaceHandler(w http.ResponseWriter, r *http.Request, thisu
|
|
|
}
|
|
|
|
|
|
if !scriptExists {
|
|
|
- utils.SendErrorResponse(w, "Script not found")
|
|
|
+ w.WriteHeader(http.StatusInternalServerError)
|
|
|
+ w.Write([]byte("500 - Internal Server Error: Script not exists"))
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -232,7 +234,7 @@ func (g *Gateway) InterfaceHandler(w http.ResponseWriter, r *http.Request, thisu
|
|
|
if !thisuser.GetModuleAccessPermission(moduleName) {
|
|
|
w.WriteHeader(http.StatusForbidden)
|
|
|
if g.Option.BuildVersion == "development" {
|
|
|
- w.Write([]byte("Permission denied: User do not have permission to access " + moduleName))
|
|
|
+ w.Write([]byte("403 Forbidden: User do not have permission to access " + moduleName))
|
|
|
} else {
|
|
|
w.Write([]byte("403 Forbidden"))
|
|
|
}
|
|
@@ -256,7 +258,8 @@ func (g *Gateway) InterfaceHandler(w http.ResponseWriter, r *http.Request, thisu
|
|
|
//Get the content of the script
|
|
|
scriptContentByte, err := os.ReadFile(scriptFile)
|
|
|
if err != nil {
|
|
|
- w.Write([]byte("Script load error: " + err.Error()))
|
|
|
+ w.WriteHeader(http.StatusInternalServerError)
|
|
|
+ w.Write([]byte("500 - Internal Server Error: Script load error =>" + err.Error()))
|
|
|
return
|
|
|
}
|
|
|
scriptContent := string(scriptContentByte)
|