From d43badb4ecac092c897cb52cc54696d1489bc2e0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 8 Jan 2010 11:11:38 -0800 Subject: Change url parsing in resolve() to ignore the query string. --- modules/rest/helpers/rest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules') 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); -- cgit v1.2.3