File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -62,5 +62,8 @@ function stripIndexHtml(url: string): string {
6262 if ( url . length > 10 && StringWrapper . substring ( url , url . length - 11 ) == '/index.html' ) {
6363 return StringWrapper . substring ( url , 0 , url . length - 11 ) ;
6464 }
65+ if ( url . length > 1 && url [ url . length - 1 ] == '/' ) {
66+ url = StringWrapper . substring ( url , 0 , url . length - 1 ) ;
67+ }
6568 return url ;
6669}
Original file line number Diff line number Diff line change @@ -38,6 +38,14 @@ export function main() {
3838 it ( 'should not prepend urls with starting slash when an empty URL is provided' ,
3939 ( ) => { expect ( location . normalizeAbsolutely ( '' ) ) . toEqual ( browserLocation . baseHref ) ; } ) ;
4040
41+ it ( 'should not prepend path with an extra slash when a baseHref has a trailing slash' , ( ) => {
42+ browserLocation = new DummyBrowserLocation ( ) ;
43+ browserLocation . spy ( 'pushState' ) ;
44+ browserLocation . baseHref = '/my/slashed/app/' ;
45+ location = new Location ( browserLocation ) ;
46+ expect ( location . normalizeAbsolutely ( '/page' ) ) . toEqual ( '/my/slashed/app/page' ) ;
47+ } ) ;
48+
4149 it ( 'should not append urls with leading slash on navigate' , ( ) => {
4250 location . go ( '/my/app/user/btford' ) ;
4351 expect ( browserLocation . spy ( 'pushState' ) )
You can’t perform that action at this time.
0 commit comments