summaryrefslogtreecommitdiff
path: root/modules/rest/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-11-22 22:01:11 -0800
committerBharat Mediratta <bharat@menalto.com>2010-11-22 22:01:11 -0800
commit554ca2e683297489251d621e2c959a6a467a6f9c (patch)
treec9e38882dcb702c9d97ba6f97efb490fcbe9a7ac /modules/rest/helpers
parent3c523bcac6e902973c5891c02842254eaecd33a4 (diff)
Take into account the core.url_suffix configuration setting when
parsing REST urls. This fixes the problem that setting the url suffix breaks REST. Fixes #1500.
Diffstat (limited to 'modules/rest/helpers')
-rw-r--r--modules/rest/helpers/rest.php7
1 files changed, 6 insertions, 1 deletions
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);