diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/rest/controllers/rest.php | 3 | ||||
-rw-r--r-- | modules/rest/helpers/rest.php | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/modules/rest/controllers/rest.php b/modules/rest/controllers/rest.php index a721ff2b..c4e0fda4 100644 --- a/modules/rest/controllers/rest.php +++ b/modules/rest/controllers/rest.php @@ -86,6 +86,9 @@ class Rest_Controller extends Controller { } $request->url = url::abs_current(true); + if ($suffix = Kohana::config('core.url_suffix')) { + $request->url = substr($request->url, 0, strlen($request->url) - strlen($suffix)); + } rest::set_active_user($request->access_key); diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php index d5ed0452..58943700 100644 --- a/modules/rest/helpers/rest.php +++ b/modules/rest/helpers/rest.php @@ -122,7 +122,12 @@ class rest_Core { * @return mixed the corresponding object (usually a model of some kind) */ static function resolve($url) { - $relative_url = substr($url, strlen(url::abs_site("rest"))); + if ($suffix = Kohana::config('core.url_suffix')) { + $relative_url = substr($url, strlen(url::abs_site("rest")) - strlen($suffix)); + } else { + $relative_url = substr($url, strlen(url::abs_site("rest"))); + } + $path = parse_url($relative_url, PHP_URL_PATH); $components = explode("/", $path, 3); |