Skip to content

Dioxus Router fails to parse + in URL query string #5280

@johnny-smitherson

Description

@johnny-smitherson

Problem

The router does not parse + as space in query string. This is because the router will never put the + there, only %20. But other websites and services will change that %20 into + in the URL when they process URLs, for example facebook products.

Steps To Reproduce

Steps to reproduce the behavior:

  1. make app with router with query string route like ?:q
#[derive(Debug, Clone, Routable, PartialEq)]
#[rustfmt::skip]
pub enum Route {
    #[layout(Navbar)]
    #[route("/?:query")]
    Home {query: String},
}
  1. navigate to page with space in q, for example query=Shis Kebap = https://dj-vaslui.alt-f4.ro/?query=Shis%20Kebap

  2. copy/paste above URL into facebook messenger

  3. click the processed URL from facebook messenger

  4. Zuck will do MITM redirects on the URL and change it into https://dj-vaslui.alt-f4.ro/?query=Shis+Kebap and thus save on 2 bytes

  5. dioxus router fails to parse the + as as per the URL spec, and my query string is now query=Shis+Kebap

Expected behavior

Router should parse + as as per URL spec, even if it never put the + there itself.

https://en.wikipedia.org/wiki/Query_string#URL_encoding

Screenshots


before zuck

Image

after zuck

Image

Environment:

  • Dioxus version: 0.7.3
  • Rust version: 1.93
  • OS info: debian 11 on docker
  • App platform: web

Questionnaire

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrouterRelated to the router implementation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions