aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngResource
diff options
context:
space:
mode:
authorGias Kay Lee2013-12-20 23:15:46 +0800
committerIgor Minar2014-01-02 23:07:27 -0800
commit131e4014b831ac81b7979c4523da81ebc5861c70 (patch)
tree8f4e73fb8e3e5e939f930ba956c73dd3fb1997dc /src/ngResource
parent01c5be4681e34cdc5f5c461b7a618fefe8038919 (diff)
downloadangular.js-131e4014b831ac81b7979c4523da81ebc5861c70.tar.bz2
fix($resource): prevent URL template from collapsing into an empty string
if url template would result in an empty string, we should make a request to '/' instead. Closes #5455 Closes #5493
Diffstat (limited to 'src/ngResource')
-rw-r--r--src/ngResource/resource.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js
index dedbf860..8874bbec 100644
--- a/src/ngResource/resource.js
+++ b/src/ngResource/resource.js
@@ -401,7 +401,7 @@ angular.module('ngResource', ['ng']).
});
// strip trailing slashes and set the url
- url = url.replace(/\/+$/, '');
+ url = url.replace(/\/+$/, '') || '/';
// then replace collapse `/.` if found in the last URL path segment before the query
// E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`
url = url.replace(/\/\.(?=\w+($|\?))/, '.');