You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The (needed) "index.html" disappears from Location URL upon page refresh or direct navigation #19296
[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
I don't have a ready-made reproduction (sorry, too new at this), but I'm working with a team of folks on a version control repository (Git/Subversion) viewer type of application (rather like the GitHub code browser) where the repository path to be viewed is carried in the Angular app's route URL. For example, the repository path of a Subversion-versioned project's website index file might be /trunk/www/index.html, and the Angular app's route for displaying the contents of that file might be {{base_href}}/{{project_name}}/view/trunk/www/index.html.
Note firstly that this all works as expected for most versioned items. But for paths that actually end in the literal string index.html, Angular eats that bit of the location URL and the app shows the parent directory instead. Now, from the parent directory display of my app (which shows as a directory listing with each subdirectory and file linked, as expected), I can navigate into an index.html repository file's display successfully. But if I refresh the page, I see the Location URL change to have the index.html removed and my app again shows the parent directory listing.
For a reproduction, you can use the following. It would be good to have one available, and you should be able to create it pretty quickly using one of the following links:
@jasonaden_stripIndexHtml() which appears to cause this nowadays seems to have been added in ec455e1 last April by you, although probably recreating existing behavior? Do you know if this can be removed without breaking a lot of existing Angular apps? I am working on a version control file viewing application similar to the OP, where it's important to preserve the full URL.
Activity
cmpilato commentedon Nov 29, 2017
I have confirmed that this remains a bug in Angular 5.0.1.
cmpilato commentedon Nov 29, 2017
It does appear, though, that as workaround, I can enter the URL using percent encoding for the slashes in the "path" part of route:
{{base_href}}/{{project_name}}/view/trunk%2Fwww%2Findex.htmljasonaden commentedon Dec 5, 2017
Interesting. Thanks for logging the issue.
For a reproduction, you can use the following. It would be good to have one available, and you should be able to create it pretty quickly using one of the following links:
We suggest using StackBlitz or Plunker.
guedeWebGate commentedon Sep 18, 2018
Any plan to fix this?
webdevelopland commentedon Feb 10, 2020
I faced the same issue.
@jasonaden Here's the reproduction:
https://stackblitz.com/edit/angular-gitter-vxwxph
When we try
?path=folder/index.htmlas param, path becomesfolder,index.htmldisappears.hermannloose commentedon Feb 24, 2020
@jasonaden
_stripIndexHtml()which appears to cause this nowadays seems to have been added in ec455e1 last April by you, although probably recreating existing behavior? Do you know if this can be removed without breaking a lot of existing Angular apps? I am working on a version control file viewing application similar to the OP, where it's important to preserve the full URL.docs(common): Add note to location about investigating base href hand…
docs(common): Add note to location about investigating base href hand…
docs(common): Add note to location about investigating base href hand…
docs(common): Add note to location about investigating base href hand…
kdb13 commentedon Jul 10, 2025
Has anyone found a workaround for this issue until it gets fixed?