简体   繁体   English

出现错误:无法匹配任何路由。 URL 段:

[英]Got Error: Cannot match any routes. URL Segment:

Angular App throwing Cannot match any routes error with XSS script in URL: Angular App throwing Cannot match any routes error with XSS script in URL:

I am developing an application in Angular 4. When I am trying to write routes for a feature module, I am getting an error as Error: Cannot match any routes.我正在 Angular 4 中开发应用程序。当我尝试为功能模块编写路由时,我收到错误消息:无法匹配任何路由。

Here's the routes code I have used:这是我使用的路线代码:

const ROUTES: Routes = [
  {path: '', redirectTo: '/', pathMatch: 'full'},
  {path: 'test/:name', component: TestCompnent},
  {path: '**', component: TestCompnent}
];

Routing is working fine and going to the TestCompnent when the route is something like test/angular or test/some-course-name but when I try to inject some XSS script into the same route, such as当路由类似于 test/angular 或 test/some-course-name 但当我尝试将一些 XSS 脚本注入同一路由时,路由工作正常并转到 TestCompnent,例如

test/<script>alert('hello')</script>,

its throwing an error as它抛出一个错误

Error: Cannot match any routes.错误:无法匹配任何路由。 URL Segment: ''hello'' Error: Cannot match any routes. URL 段:“你好”错误:无法匹配任何路由。 URL Segment: ''hello'' URL 段:“你好”

That is expected and wanted behavior, since XSS is a major vulnarability for most services.这是预期和想要的行为,因为 XSS 是大多数服务的主要漏洞。 Therefor the guys and girls over at Google did their best to disable them.因此,谷歌的伙计们尽了最大的努力来禁用它们。 Docs文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM