Skip to content

Router URL cannot be accessed directly if parameter contains "." (dot) in it's value #8249

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

Closed
dtolstyi opened this issue Apr 26, 2016 · 11 comments

Comments

@dtolstyi
Copy link

dtolstyi commented Apr 26, 2016

Description
As soon as you try to access URL containing . symbol the page cannot be displayed.

Steps to reproduce and a minimal demo of the problem

  1. Create router accepting parameter, e.g.:
    { path: '/data/:date', component: DataDetails, name: 'DataDetails' }
  2. Try accessing URL from your browser: http://localhost/data/2016.05

Current behavior
An error is returned that page cannot be displayed (Error 404)

Expected/desired behavior
Corresponding component is properly displayed.

Other information

  1. If you access this URL programmatically, e.g. using:
    this._router.navigateByUrl('/data/2016.05');
    it works fine and proper component is shown.
  2. As soon as you remove . from the URL, e.g.: http://localhost/data/2016-05 it works fine as well.
    Looks like the problem is cause by . symbol.
@MarkusPint
Copy link

Still an issue with @angular/[email protected]

@Perezmarc
Copy link

Did you solve this?

@nschipperbrainsmith
Copy link

Reporting here that I'm experiencing this problem as well when we redirect to a url in which the users email is contained. I can't use the users email in this case as it contains a dot.

@nbuso
Copy link

nbuso commented Sep 30, 2016

Same problem here

@DzmitryShylovich
Copy link
Contributor

DzmitryShylovich commented Oct 30, 2016

Cannot reproduce it using express server. Looks like the issue is related to webpack dev server treated urls with dots as file names webpack/webpack-dev-server#454

The same issue in cli angular/angular-cli#2168

tl tr just add

historyApiFallback: {
      disableDotRule: true
    },

into webpack dev server config

@vsavkin vsavkin self-assigned this Nov 2, 2016
@vsavkin
Copy link
Contributor

vsavkin commented Nov 2, 2016

I'm sorry but we can't reproduce the problem following the instructions you provided.

If the problem still exists please open a new issue with a plunkr reproducing the problem.

@vsavkin vsavkin closed this as completed Nov 2, 2016
@gyuho
Copy link

gyuho commented Nov 2, 2016

@vsavkin I am still having this issue with

angular-cli: 1.0.0-beta.15

@angular/common: 2.0.0
@angular/compiler: 2.0.0
@angular/core: 2.0.0
@angular/forms: 2.0.0
@angular/http": 2.0.0
@angular/platform-browser: 2.0.0
@angular/platform-browser-dynamic: 2.0.0
@angular/router: 3.0.0

What version of angular should I try to see if it is resolved?

Thanks!

@gyuho
Copy link

gyuho commented Nov 3, 2016

Ok this is probably fixed by newer versions. I tried this and works

  "dependencies": {
    "@angular/common": "~2.1.0",
    "@angular/compiler": "~2.1.0",
    "@angular/core": "~2.1.0",
    "@angular/forms": "~2.1.0",
    "@angular/http": "~2.1.0",
    "@angular/platform-browser": "~2.1.0",
    "@angular/platform-browser-dynamic": "~2.1.0",
    "@angular/router": "~3.1.0",
    "core-js": "^2.4.1",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@types/jasmine": "^2.2.30",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.19-3",
    "codelyzer": "1.0.0-beta.1",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.9",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "~2.0.3",
    "webdriver-manager": "10.2.5"
  }

Thanks!

@donwilli
Copy link

donwilli commented Jun 13, 2017

Hey,

i have still this Problem in Version 4.0.3

"dependencies": {
"@angular/common": "^4.0.3",
"@angular/compiler": "^4.0.3",
"@angular/core": "^4.0.3",
"@angular/forms": "^4.0.3",
"@angular/http": "^4.0.3",
"@angular/platform-browser": "^4.0.3",
"@angular/platform-browser-dynamic": "^4.0.3",
"@angular/router": "^4.0.3",
"angular-in-memory-web-api": "^0.3.2",
"core-js": "^2.4.1",
"devextreme": "^16.2.7",
"devextreme-angular": "^16.2.7",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"zone.js": "^0.8.12"
},
"devDependencies": {
"@types/jasmine": "2.5.36",
"@types/node": "^6.0.78",
"canonical-path": "0.0.2",
"concurrently": "^3.2.0",
"jasmine-core": "~2.4.1",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.1.1",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"tslint": "^3.15.1",
"typescript": "~2.1.0"
}

@rubenkuipers
Copy link

I had the same issue and the solution of @DzmitryShylovich worked for me.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests