From eb60a8b2874a348fec104672ce7d5d991faa3d47 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 30 Jun 2016 10:17:46 -0600 Subject: [PATCH] Use absUrl, so WEBROOT isn't ignored on redirect For the 'fall-through' condition for Angular routing, it will simply redirect to the URL wanted. Basically, Angular says: "If I don't know this URL in my internal routing, it's outside the single-page-app and needs to be pulled from the server." However, the code uses the general Angular path, which does NOT include the base tag's prefix, meaning in a situation where WEBROOT is set to other than '/' it will not include the base value, and route to a non-WEBROOTed path. Using absUrl correctly uses the full path. Change-Id: Idbf91bd5913937788bf31bcf1d389c590dd3e2d7 Closes-Bug: 1597823 --- openstack_dashboard/static/app/redirect.controller.js | 2 +- openstack_dashboard/static/app/redirect.controller.spec.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openstack_dashboard/static/app/redirect.controller.js b/openstack_dashboard/static/app/redirect.controller.js index 448217bab4..f1c110b738 100644 --- a/openstack_dashboard/static/app/redirect.controller.js +++ b/openstack_dashboard/static/app/redirect.controller.js @@ -44,7 +44,7 @@ waitSpinnerService ) { waitSpinnerService.showModalSpinner(gettext('Loading')); - $window.location.href = $location.path(); + $window.location.href = $location.absUrl(); } }()); diff --git a/openstack_dashboard/static/app/redirect.controller.spec.js b/openstack_dashboard/static/app/redirect.controller.spec.js index 23ead8010f..bfd80b492c 100644 --- a/openstack_dashboard/static/app/redirect.controller.spec.js +++ b/openstack_dashboard/static/app/redirect.controller.spec.js @@ -32,7 +32,8 @@ controller = $injector.get('$controller'); waitSpinnerService = $injector.get('horizon.framework.widgets.modal-wait-spinner.service'); - spyOn($location, 'path').and.returnValue('path'); + // NOTE: This is using absUrl, so requests will already include WEBROOT. + spyOn($location, 'absUrl').and.returnValue('path'); }); });