csells / go_router

The purpose of the go_router for Flutter is to use declarative routes to reduce complexity, regardless of the platform you're targeting (mobile, web, desktop), handling deep linking from Android, iOS and the web while still allowing an easy-to-use developer experience.
https://gorouter.dev
441 stars 97 forks source link

URL ending with forward slash `/` should not throw an error #191

Closed osaxma closed 2 years ago

osaxma commented 2 years ago

Currently, whenever there's a forward slash at the end of the URL (e.g., /books/popular/), the following error occurs:

The following _Exception was thrown Exception during GoRouter navigation:
Exception: no routes for location: /books/popular/

I believe it'd be reasonable to treat the following two URLs as the same thing since it's a common behavior among most websites:

 /books/popular/
 /books/popular 

Simplest use case is when a user modifies the URL manually and leaves the slash up there. It'd be a bad UX if the user receive an error page for such a case.

csells commented 2 years ago

You're absolutely right. That should work. I'm take a look.

csells commented 2 years ago

v2.3.1 should fix this issue. @osaxma can you please verify?

osaxma commented 2 years ago

Thanks Chris -- it's working now 🙏🏽

csells commented 2 years ago

Thanks for the bug reports, @osaxma. You're making go_router better.