Skip to content

Router.navigateByUrl navigate to base URL i.e. / when % used as prefix/suffix/in-middle in query param #54937

@narendrasinghrathore

Description

@narendrasinghrathore

Which @angular/* package(s) are the source of the bug?

router

Is this a regression?

Yes

Description

Router.navigateByUrl navigate to base URL i.e. / when % used as prefix/suffix/in-middle in query param even if encode them explicitly

For example below URL(s) when used to navigate, it will jump to base URL without any error

http://localhost:4200/#/main/search/144/results?Name=test%
http://localhost:4200/#/main/search/144/results?Name=test%test
http://localhost:4200/#/main/search/144/results?Name=%test
http://localhost:4200/#/main/search/144/results?Name=test%25
http://localhost:4200/#/main/search/144/results?Name=%25test
http://localhost:4200/#/main/search/144/results?Name=test%25test

image

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

NA

Please provide the environment you discovered this bug in (run ng version)

/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | | 
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | | 
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|                |___/
    

Angular CLI: 17.1.2
Node: 18.13.0
Package Manager: npm 10.2.5
OS: win32 x64

Angular: 17.1.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------    
@angular-devkit/architect       0.1701.2
@angular-devkit/build-angular   17.1.2
@angular-devkit/core            17.1.2
@angular-devkit/schematics      17.1.2
@schematics/angular             17.1.2
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.3

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: routerrouter: URL parsing/generation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions