From 8d96eabef7d686b4630bca666a287f54ab67d460 Mon Sep 17 00:00:00 2001 From: Abhinav Upadhyay Date: Wed, 29 Jan 2014 16:49:15 +0530 Subject: [PATCH] Fix a minor bug in the playground app, resulting in 404's in some cases. For some reason, the browser keeps appending a trailing '/' at the end of the URLs. Since the loadExample function in playground.js parses the request parameter itself and uses it to load the JSON, a trailing '/' at the end of the URL causes the function to generate a request for a JSON named '.json'. The PR adds a check for a trailing '/' and taking appropriate action if there is a trailing slash. --- playground/playground.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/playground/playground.js b/playground/playground.js index 4db91bf7..7ffbf0f7 100644 --- a/playground/playground.js +++ b/playground/playground.js @@ -133,6 +133,8 @@ $('document').ready(function () { for (var i = 0; i < vars.length; i++) { param = vars[i].split('='); if (param[0] === 'example') { + if (param[1].charAt(param[1].length - 1) == '/') + return param[1].replace('/', ''); return param[1]; } } @@ -221,4 +223,4 @@ $('document').ready(function () { loadExample(example); } }, 1000); -}); \ No newline at end of file +});