summaryrefslogtreecommitdiff
path: root/modules/rest
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-08 11:11:38 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-08 11:11:38 -0800
commitd43badb4ecac092c897cb52cc54696d1489bc2e0 (patch)
tree395b8c8356a9eb61620e88399d9641a96c4c209a /modules/rest
parentc711bf1b1fcf7840467a7a044b1f511e7b69c139 (diff)
Change url parsing in resolve() to ignore the query string.
Diffstat (limited to 'modules/rest')
-rw-r--r--modules/rest/helpers/rest.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php
index b1b83e1b..121191f2 100644
--- a/modules/rest/helpers/rest.php
+++ b/modules/rest/helpers/rest.php
@@ -60,10 +60,10 @@ class rest_Core {
* @return mixed the corresponding object (usually a model of some kind)
*/
static function resolve($url) {
- $components = explode("/", substr($url, strlen(url::abs_site("rest"))), 3);
+ $relative_url = substr($url, strlen(url::abs_site("rest")));
+ $path = parse_url($relative_url, PHP_URL_PATH);
+ $components = explode("/", $path, 3);
- // The first component will be empty because of the slash between "rest" and the
- // resource type.
$class = "$components[1]_rest";
if (!method_exists($class, "resolve")) {
throw new Kohana_404_Exception($url);