Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Issue 2515 fixup absolute path #2516

Merged
merged 2 commits into from Sep 25, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion resources/static/dialog/js/modules/dialog.js
Expand Up @@ -109,6 +109,16 @@ BrowserID.Modules.Dialog = (function() {
throw "must be an absolute path: (" + path + ")";
}

function fixupReturnTo(origin_url, path) {
// "/" is a valid returnTo, but it is not a valid path for any other
// parameter. If the path is "/", allow it, otherwise pass the path down
// the normal checks.
var returnTo = path === "/" ?
origin_url + path :
fixupAbsolutePath(origin_url, path);
return returnTo;
}

function validateRPAPI(rpAPI) {
var VALID_RP_API_VALUES = [
"watch_without_onready",
Expand Down Expand Up @@ -225,7 +235,7 @@ BrowserID.Modules.Dialog = (function() {
// returnTo is used for post verification redirection. Redirect back
// to the path specified by the RP.
if (paramsFromRP.returnTo) {
var returnTo = fixupAbsolutePath(origin_url, paramsFromRP.returnTo);
var returnTo = fixupReturnTo(origin_url, paramsFromRP.returnTo);
user.setReturnTo(returnTo);
}

Expand Down