From d5073110f1943fad1350349e8fdfa6cb0c2199fe Mon Sep 17 00:00:00 2001 From: Anup Shinde Date: Tue, 29 Jan 2013 18:32:26 +0530 Subject: [PATCH] Fixed issue - Localstorate reverselookup fails in case the urls contain a # and have no ? character MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The lookup in localstorage fails in case the urls contain a # and have no ? character This is also related to the tweet: https://twitter.com/muslimbit/statuses/252336629744820224 --- lib/oauth2_finish.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/oauth2_finish.js b/lib/oauth2_finish.js index 1762546..d20214a 100644 --- a/lib/oauth2_finish.js +++ b/lib/oauth2_finish.js @@ -22,7 +22,12 @@ var index = url.indexOf('?'); if (index > -1) { url = url.substring(0, index); } +// In cases where the URL contains a # character directly without having a ? char - example http://a.com/bc#code=xys +index = url.indexOf('#'); +if (index > -1) { + url = url.substring(0, index); +} // Derive adapter name from URI and then finish the process. var adapterName = OAuth2.lookupAdapterName(url); -var finisher = new OAuth2(adapterName, OAuth2.FINISH); \ No newline at end of file +var finisher = new OAuth2(adapterName, OAuth2.FINISH);