From 131e4014b831ac81b7979c4523da81ebc5861c70 Mon Sep 17 00:00:00 2001 From: Gias Kay Lee Date: Fri, 20 Dec 2013 23:15:46 +0800 Subject: 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 --- src/ngResource/resource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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+($|\?))/, '.'); -- cgit v1.2.3