-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
fix(aio): do not fallback to index.html
for file requests
#15401
Conversation
Previously, all URLs were rewritten to `index.html` in order to support deep-linking. This works when navigating to URLs that correspond to existing resources. E.g. navigating to `/tutorial` returns `index.html` and then the `DocViewer` takes over and requests `tutorial.json`. Navigating to a non-existent URL (e.g. `/foo`), will return `index.html`, which in turn requests (the non-existent) `foo.json` and throws an error when trying to parse the returned `index.html` as JSON. This commit fixes it by only rewriting URLs that do not request a file (i.e. do not include a `.` in the last path segment). Fixes angular#15398
One thing this doesn't fix is if we tried to navigation to a url that maps to a non-valid JSON file. |
@petebacondarwin, can you give an example URL? |
We don't have any bad ones any more because we blocked the private imports and that VERSION const. So no. |
So, the issue you mentioned above affects anchor elements pointing to invalid URLs? UPDATE: I tried that and everything seems to work as expcted 😕 |
I think we do have it working but it was breaking when @IgorMinar was clicking on invalid links in the staging website. But we cannot reproduce that now, since this PR stops the staging site from sending invalid JSON to 404 links. |
I am happy to move on until someone else complains with a repro. |
…15401) Previously, all URLs were rewritten to `index.html` in order to support deep-linking. This works when navigating to URLs that correspond to existing resources. E.g. navigating to `/tutorial` returns `index.html` and then the `DocViewer` takes over and requests `tutorial.json`. Navigating to a non-existent URL (e.g. `/foo`), will return `index.html`, which in turn requests (the non-existent) `foo.json` and throws an error when trying to parse the returned `index.html` as JSON. This commit fixes it by only rewriting URLs that do not request a file (i.e. do not include a `.` in the last path segment). Fixes angular#15398
…15401) Previously, all URLs were rewritten to `index.html` in order to support deep-linking. This works when navigating to URLs that correspond to existing resources. E.g. navigating to `/tutorial` returns `index.html` and then the `DocViewer` takes over and requests `tutorial.json`. Navigating to a non-existent URL (e.g. `/foo`), will return `index.html`, which in turn requests (the non-existent) `foo.json` and throws an error when trying to parse the returned `index.html` as JSON. This commit fixes it by only rewriting URLs that do not request a file (i.e. do not include a `.` in the last path segment). Fixes angular#15398
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Previously, all URLs were rewritten to
index.html
in order to supportdeep-linking. This works when navigating to URLs that correspond to existing
resources. E.g. navigating to
/tutorial
returnsindex.html
and then theDocViewer
takes over and requeststutorial.json
.Navigating to a non-existent URL (e.g.
/foo
), will returnindex.html
, whichin turn requests (the non-existent)
foo.json
and throws an error when tryingto parse the returned
index.html
as JSON.This commit fixes it by only rewriting URLs that do not request a file (i.e. do
not include a
.
in the last path segment).Fixes #15398