-
-
Notifications
You must be signed in to change notification settings - Fork 33
Description
The use case is for a roundtrip to a login page that then is supposed to take you back to the original page including its query parameters.
You will then have a returnUrl query parameter which has doubly-encoded query parameters which are not handled properly because flow-router seems to decode the query parameters twice when it is vital that they are only decoded once.
Example:
Original url:
http://localhost:3000/projects?param1=abc&redirectUrl=https%3A%2F%2Fwww.company.com%2Fabc123
The queryParams provided by FlowRouter to the route registered for /login will now be
{returnUrl: "/projects?param1=abc", redirectUrl: "https://www.company.com/abc123"}
i.e. the entire redirectUrl part of the returnUrl is lost.
The hack fix is to use qs directly instead of the queryParam provided by FlowRouter
qs.parse(window.location.search, {
ignoreQueryPrefix: true,
});
which gives the correct result:
{returnUrl: "/projects?param1=abc&redirectUrl=https%3A%2F%2Fwww.company.com%2Fabc123"}
This happens when using kadira:flowrouter and [email protected], regardless of using the latest qs version (6.9.3) or some earlier version like 6.5.1.
This is for Meteor 1.10.1