Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

route_with_tsr doesn't redirect to actual path, but only uses the route #1605

Closed
syphar opened this issue Dec 1, 2022 · 1 comment · Fixed by #1608
Closed

route_with_tsr doesn't redirect to actual path, but only uses the route #1605

syphar opened this issue Dec 1, 2022 · 1 comment · Fixed by #1608
Assignees
Labels
A-axum-extra C-bug Category: This is a bug.

Comments

@syphar
Copy link

syphar commented Dec 1, 2022

Bug Report

Version

  • axum 0.6.1
  • axum-extra 0.4.1

Platform

Darwin mondo-0984 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64

Crates

axum-extra

Description

with axum 0.5 we have the following routes:

Router::new()
    .route("/about/:subpage", get_internal(super::sitemap::about_handler))

for which axum would correctly

  • serve the page when for example calling /about/download
  • serve a redirect to the page above when called via /about/download/

Now with axum 0.6 we would:

Router::new()
    .route_with_tsr("/about/:subpage", get_internal(super::sitemap::about_handler))

for which axum would now

  • serve the correct subpage when requesting /about/download
  • but when called via /about/download/, I'm getting a redirect to /about/:subpage, so not the actual redirect target I need.

From the source it looks like the router just uses the route-name as redirect target, not the actual path from the request.

@davidpdrsn
Copy link
Member

The fix for this was released in axum-extra 0.4.2 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-axum-extra C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants