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
This commit is contained in:
Matt Borland 2016-06-30 10:17:46 -06:00
parent c6f3f6f332
commit eb60a8b287
2 changed files with 3 additions and 2 deletions

View File

@ -44,7 +44,7 @@
waitSpinnerService waitSpinnerService
) { ) {
waitSpinnerService.showModalSpinner(gettext('Loading')); waitSpinnerService.showModalSpinner(gettext('Loading'));
$window.location.href = $location.path(); $window.location.href = $location.absUrl();
} }
}()); }());

View File

@ -32,7 +32,8 @@
controller = $injector.get('$controller'); controller = $injector.get('$controller');
waitSpinnerService = $injector.get('horizon.framework.widgets.modal-wait-spinner.service'); 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');
}); });
}); });