Skip to content

[go_router] Doesn't support "/abc", "/ABC" as two different paths #169809

@deegoy2

Description

@deegoy2

What package does this bug report belong to?

go_router

What target platforms are you seeing this bug on?

Web

Have you already upgraded your packages?

Yes

Dependency versions

pubspec.lock
packages:
  go_router:
    dependency: "direct main"
    description:
      name: go_router
      sha256: "0b1e06223bee260dee31a171fb1153e306907563a0b0225e8c1733211911429a"
      url: "https://pub.dev"
    source: hosted
    version: "15.1.2"

Steps to reproduce

  1. go_router configuration:
final GoRouter _router = GoRouter(
  initialLocation: '/',
  routes: <RouteBase>[
    GoRoute(path: '/', builder: (_, _) => Home(),),
    GoRoute(path: '/abc', builder: (_, _) => Home(),),
    GoRoute(path: '/ABC', builder: (_, _) => Home(),),
  ],
);
  1. Run the app.
  2. Open "/abc", it should work.
  3. Open "/ABC", throws an exception.

Expected results

The part of the URL after the domain name (the "path" or "directory" part) is generally case-sensitive on most web servers, especially those running on Unix-like operating systems, so expectation is that all three endpoints should render Home().

Actual results

"/ABC" throws

======== Exception caught by widgets library =======================================================
The following assertion was thrown building DefaultSelectionStyle:
Assertion failed: file:///C:/Users/user/AppData/Local/Pub/Cache/hosted/pub.dev/go_router-15.1.2/lib/src/match.dart:245:12
uriPathToCompare.startsWith(newMatchedLocationToCompare)
is not true

Code sample

Code sample
final GoRouter _router = GoRouter(
  initialLocation: '/',
  routes: <RouteBase>[
    GoRoute(path: '/', builder: (_, _) => Home(),),
    GoRoute(path: '/abc', builder: (_, _) => Home(),),
    GoRoute(path: '/ABC', builder: (_, _) => Home(),),
  ],
);

Screenshots or Videos

Screenshots / Video demonstration

Image

Logs

Logs
======== Exception caught by widgets library =======================================================
The following assertion was thrown building DefaultSelectionStyle:
Assertion failed: file:///C:/Users/user/AppData/Local/Pub/Cache/hosted/pub.dev/go_router-15.1.2/lib/src/match.dart:245:12
uriPathToCompare.startsWith(newMatchedLocationToCompare)
is not true

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.32.0, on Microsoft Windows [Version 10.0.22631.5189], locale en-US)
[√] Windows Version (11 Pro 64-bit, 23H2, 2009)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 2024.3.2)
[√] IntelliJ IDEA Community Edition (version 2023.1)
[√] VS Code (version 1.100.2)
[√] Connected device (3 available)
[√] Network resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: go_routerThe go_router packagepackageflutter/packages repository. See also p: labels.platform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions