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

Outlet route is not recognised if URL is encoded #43523

Open
yuriykuzin opened this issue Sep 21, 2021 · 0 comments
Open

Outlet route is not recognised if URL is encoded #43523

yuriykuzin opened this issue Sep 21, 2021 · 0 comments
Labels
area: router P4 A relatively minor issue that is not relevant to core functions router: config matching/activation/validation
Milestone

Comments

@yuriykuzin
Copy link

yuriykuzin commented Sep 21, 2021

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

router

Is this a regression?

No

Description

In fact, I want to re-open this issue: #26035

Current behaviour

Some software tools change URLs escaping some symbols, like ( and )
So URL like this: https://site.com/(modal:reset)
Becomes: https://site.com/%28modal:reset%29 which is still a valid URL.

When such URL is opened, Angular cannot find such route (reproduced on the latest Angular 12.2.5 - https://stackblitz.com/edit/angular-9xudgi?file=src/app/app.component.html).

Expected behaviour

URL should be decoded before looking for an activated route.

Minimal reproduction of the problem with instructions

  • Setup a route that has an outlet.
  • Replace parentheses with %28 and %29 respectively
  • Open the URL directly

Possible solution

To solve this I use custom UrlSerializer like suggested here: https://digitalflask.com/blog/extend-angular-router

This works fine, but I wonder why decoding isn't implemented by default?

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-9xudgi?file=src/app/app.component.html

Please provide the exception or error you saw

ERROR
Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: '%28modal:modal%29'
Error: Cannot match any routes. URL Segment: '%28modal:modal%29'
at ApplyRedirects.noMatchError (https://angular-9xudgi.stackblitz.io/turbo_modules/@angular/router@12.2.5/bundles/router.umd.js:3126:20)
at eval (https://angular-9xudgi.stackblitz.io/turbo_modules/@angular/router@12.2.5/bundles/router.umd.js:3107:33)
at eval (https://angular-9xudgi.stackblitz.io/turbo_modules/rxjs@7.3.0/dist/cjs/internal/operators/catchError.js:13:46)
at OperatorSubscriber._this._error (https://angular-9xudgi.stackblitz.io/turbo_modules/rxjs@7.3.0/dist/cjs/internal/operators/OperatorSubscriber.js:38:21)
at OperatorSubscriber.Subscriber.error (https://angular-9xudgi.stackblitz.io/turbo_modules/rxjs@7.3.0/dist/cjs/internal/Subscriber.js:81:18)
at OperatorSubscriber.Subscriber._error (https://angular-9xudgi.stackblitz.io/turbo_modules/rxjs@7.3.0/dist/cjs/internal/Subscriber.js:105:30)
at OperatorSubscriber.Subscriber.error (https://angular-9xudgi.stackblitz.io/turbo_modules/rxjs@7.3.0/dist/cjs/internal/Subscriber.js:81:18)
at OperatorSubscriber.Subscriber._error (https://angular-9xudgi.stackblitz.io/turbo_modules/rxjs@7.3.0/dist/cjs/internal/Subscriber.js:105:30)
at OperatorSubscriber.Subscriber.error (https://angular-9xudgi.stackblitz.io/turbo_modules/rxjs@7.3.0/dist/cjs/internal/Subscriber.js:81:18)
at OperatorSubscriber.Subscriber._error (https://angular-9xudgi.stackblitz.io/turbo_modules/rxjs@7.3.0/dist/cjs/internal/Subscriber.js:105:30)

Please provide the environment you discovered this bug in

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


Angular CLI: 11.2.13
Node: 12.16.1
OS: darwin x64

Angular: 11.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.13
@angular-devkit/build-angular   0.1102.13
@angular-devkit/core            11.2.13
@angular-devkit/schematics      11.2.13
@angular/cdk                    10.2.0
@angular/cli                    11.2.13
@angular/material               10.2.0
@schematics/angular             11.2.13
@schematics/update              0.1102.13
rxjs                            6.6.3
typescript                      4.0.2

Anything else?

No response

@atscott atscott added area: router P4 A relatively minor issue that is not relevant to core functions router: config matching/activation/validation labels Sep 21, 2021
@ngbot ngbot bot added this to the Backlog milestone Sep 21, 2021
@atscott atscott added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent P4 A relatively minor issue that is not relevant to core functions and removed P4 A relatively minor issue that is not relevant to core functions P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: router P4 A relatively minor issue that is not relevant to core functions router: config matching/activation/validation
Projects
None yet
Development

No branches or pull requests

2 participants