]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Throw 404 error if service not known
authorMarcin Haba <marcin.haba@bacula.pl>
Wed, 15 Nov 2017 20:54:21 +0000 (21:54 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Wed, 15 Nov 2017 20:54:21 +0000 (21:54 +0100)
gui/baculum/protected/Common/Class/BaculumUrlMapping.php

index 5b0d6fce2252d8d13bbf5e52e7c392825649ed90..cab9b82782e7f65c3fc4296a67c992ab1c5a59d6 100644 (file)
@@ -27,12 +27,12 @@ class BaculumUrlMapping extends TUrlMapping {
        private $services = array(
                'web' => array(
                        'url_manager' => 'Application.Web.Class.WebUrlMapping',
-                       'url_pattern' => '!^/web/!',
+                       'url_pattern' => '!^(/index\.php)?/web([/,].*)?$!',
                        'endpoints' => 'Application.Web.endpoints'
                ),
                'api' => array(
                        'url_manager' => 'Application.API.Class.APIUrlMapping',
-                       'url_pattern' => '!^/api/!',
+                       'url_pattern' => '!^(/index\.php)?/api([/,].*)?$!',
                        'endpoints' => 'Application.API.endpoints'
                )
        );
@@ -56,6 +56,7 @@ class BaculumUrlMapping extends TUrlMapping {
 
        private function setServiceUrlManager() {
                $service_id = $this->getServiceID();
+               $url = $this->getRequestedUrl();
                if (array_key_exists($service_id, $this->services)) {
                        $service = $this->services[$service_id];
                        $path = Prado::getPathOfNamespace($service['url_manager'], Prado::CLASS_FILE_EXT);
@@ -63,6 +64,8 @@ class BaculumUrlMapping extends TUrlMapping {
                                $this->setDefaultMappingClass($service['url_manager']);
                                $this->setConfigFile($service['endpoints']);
                        }
+               } elseif (!empty($url)) {
+                       throw new THttpException(404, 'pageservice_page_unknown', $url);
                }
        }