Fixing rest api dispatching for plugins with camelcase names
- plugin camelcase names are supported now
- fix for bug when a requests like
GET /plugin-erik/hello/world
GET /plugin-nonExistsPlugin/hello/world
was resolving and dispatching the same resource
This commit is contained in:
@@ -353,7 +353,7 @@ class WebApplication
|
||||
$tmp = array_shift($tmp);
|
||||
$tmp = explode('-', $tmp);
|
||||
$pluginName = $tmp[1];
|
||||
$uri = str_replace('/plugin-'.$pluginName, '', $uri);
|
||||
$uri = str_replace('plugin-'.$pluginName, strtolower($pluginName), $uri);
|
||||
}
|
||||
|
||||
// hook to get rest api classes from plugins
|
||||
@@ -370,7 +370,7 @@ class WebApplication
|
||||
|
||||
foreach ($plugin as $class) {
|
||||
if (class_exists($class['namespace'])) {
|
||||
$this->rest->addAPIClass($class['namespace']);
|
||||
$this->rest->addAPIClass($class['namespace'], strtolower($pluginName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1408,7 +1408,7 @@ class PMPluginRegistry
|
||||
|
||||
// Ensure that is registering only existent classes.
|
||||
if (class_exists($ns)) {
|
||||
$this->_restServices[strtolower($sNamespace)][] = array(
|
||||
$this->_restServices[$sNamespace][] = array(
|
||||
"filepath" => $classFile,
|
||||
"namespace" => $ns
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user