File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626// Otherwise, leave pathSegmentsToKeep as 0.
2727( ( ) => {
2828 const pathSegmentsToKeep = 0 ;
29- let l = new URL ( window . location ) ;
30- if ( ! l . search . startsWith ( '?/' ) ) {
29+ const l = new URL ( window . location ) ;
30+ // Only redirect if no '?/' anywhere - guards against repeated redirect on already-rewritten URL
31+ if ( ! l . pathname . includes ( '?/' ) && ! l . search . startsWith ( '?/' ) ) {
3132 const basePath = '/' + l . pathname . split ( '/' ) . slice ( 1 , 1 + pathSegmentsToKeep ) . join ( '/' ) ;
3233 const restPath = l . pathname . slice ( 1 ) . split ( '/' ) . slice ( pathSegmentsToKeep ) . join ( '/' ) ;
3334 const newPath = basePath + ( basePath . endsWith ( '/' ) ? '' : '/' ) + '?/' + restPath . replace ( / & / g, '~and~' ) ;
File renamed without changes.
File renamed without changes.
Load diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 2626// Otherwise, leave pathSegmentsToKeep as 0.
2727( ( ) => {
2828 const pathSegmentsToKeep = 0 ;
29- let l = new URL ( window . location ) ;
30- if ( ! l . search . startsWith ( '?/' ) ) {
29+ const l = new URL ( window . location ) ;
30+ // Only redirect if no '?/' anywhere - guards against repeated redirect on already-rewritten URL
31+ if ( ! l . pathname . includes ( '?/' ) && ! l . search . startsWith ( '?/' ) ) {
3132 const basePath = '/' + l . pathname . split ( '/' ) . slice ( 1 , 1 + pathSegmentsToKeep ) . join ( '/' ) ;
3233 const restPath = l . pathname . slice ( 1 ) . split ( '/' ) . slice ( pathSegmentsToKeep ) . join ( '/' ) ;
3334 const newPath = basePath + ( basePath . endsWith ( '/' ) ? '' : '/' ) + '?/' + restPath . replace ( / & / g, '~and~' ) ;
You can’t perform that action at this time.
0 commit comments