Use encodeURIComponent instead of encodeURI
We should use encodeURIComponent instead of encodeURI when encoding part of uri like querystring. encodeURI does not encode `+` sign. For example a query string parameter like `scope=user_id+profile+email` is not encoded by `encodeURI` which results in invalid url on select multiple enterprise page. Fixed broken test
This commit is contained in:
@@ -9,7 +9,7 @@ define([
|
||||
describe('MultipleEnterpriseInterface', function() {
|
||||
var LEARNER_URL = '/enterprise/api/v1/enterprise-learner/?username=test-learner',
|
||||
NEXT_URL = '/dashboard',
|
||||
REDIRECT_URL = '/enterprise/select/active/?success_url=/dashboard';
|
||||
REDIRECT_URL = '/enterprise/select/active/?success_url=%2Fdashboard';
|
||||
|
||||
beforeEach(function() {
|
||||
// Mock the redirect call
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* @param {string} nextUrl The URL to redirect to after multiple enterprise selection.
|
||||
*/
|
||||
check: function(nextUrl) {
|
||||
var redirectUrl = this.urls.multipleEnterpriseUrl + encodeURI(nextUrl);
|
||||
var redirectUrl = this.urls.multipleEnterpriseUrl + encodeURIComponent(nextUrl);
|
||||
var username = Utils.userFromEdxUserCookie().username;
|
||||
var next = nextUrl || '/';
|
||||
$.ajax({
|
||||
|
||||
Reference in New Issue
Block a user