From: Marcin Haba Date: Wed, 15 Nov 2017 20:54:21 +0000 (+0100) Subject: baculum: Throw 404 error if service not known X-Git-Tag: Release-9.0.6~36 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6f6d359a44482954369e7ce8f03adc5d92deeae1;p=bacula%2Fbacula baculum: Throw 404 error if service not known --- diff --git a/gui/baculum/protected/Common/Class/BaculumUrlMapping.php b/gui/baculum/protected/Common/Class/BaculumUrlMapping.php index 5b0d6fce22..cab9b82782 100644 --- a/gui/baculum/protected/Common/Class/BaculumUrlMapping.php +++ b/gui/baculum/protected/Common/Class/BaculumUrlMapping.php @@ -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); } }