Commit Graph
1 Commits
Author SHA1 Message Date
David CalaveraandDavid Pedersen 83e1a15040 Fix trailing redirection with query parameters (#936)
* Fix trailing redirection with query parameters

When the request URI matches a route that need a trailing slash, or has an extra trailing slash, the redirect URI is not generated correctly.

This change adds or removes a trailing slash to the path part of the URI, instead of the full URI, preserving query parameters during redirection.

Signed-off-by: David Calavera <[email protected]>

* Make trailing slash logic safer

Extract parts from Uri and recreate it, so it doesn't bump
into corner cases with string manipulation.

Signed-off-by: David Calavera <[email protected]>

* Remove extra assignment.

Signed-off-by: David Calavera <[email protected]>

* Update axum/src/routing/mod.rs

Co-authored-by: David Pedersen <[email protected]>

* changelog

Co-authored-by: David Pedersen <[email protected]>
2022-04-17 21:12:52 +00:00