From d8c2ad7948fd9264eab12ef9020a79c650b69bd0 Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Sat, 20 Sep 2014 21:19:00 -0400 Subject: [PATCH] docs: only re-direct when route expects a version. --- docs/components/docs/docs.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/components/docs/docs.js b/docs/components/docs/docs.js index 4fe8842007b..da018a44842 100644 --- a/docs/components/docs/docs.js +++ b/docs/components/docs/docs.js @@ -202,12 +202,13 @@ angular .run(function($location, $route, $rootScope, versions) { $rootScope.$on('$routeChangeStart', function(event, route) { var url = $location.path(); - if (url.indexOf('/docs/') === -1) { + if (url.indexOf('/docs/') === -1 || (!route.params || !route.params.version)) { + // This isn't a `docs` route or it's not one that expects a version. + // No need to re-direct request. return; } - var version = route.params && route.params.version; - if (versions.indexOf(version) === -1) { - // No version specified. + if (versions.indexOf(route.params.version) === -1) { + // No version specified where one was expected. // Route to same url with latest version prepended. event.preventDefault(); $route.reload();