File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -31,22 +31,13 @@ export function initCommitFileHistoryFollowRename() {
3131 if ( ! checkbox ) {
3232 return ;
3333 }
34- checkbox . checked = location . toString ( ) . includes ( 'history_follow_rename=true' ) ;
34+ const url = new URL ( window . location . toString ( ) ) ;
35+ checkbox . checked = url . searchParams . has ( 'history_follow_rename' , 'true' ) ;
3536
3637 checkbox . addEventListener ( 'change' , ( ) => {
37- let url = location . toString ( ) ;
38+ const url = new URL ( location . toString ( ) ) ;
3839
39- url = url . replaceAll ( / h i s t o r y _ f o l l o w _ r e n a m e = ( t r u e | f a l s e ) & * / g, '' ) ;
40- if ( url . endsWith ( '?' ) ) {
41- url = url . slice ( 0 , - 1 ) ;
42- }
43- if ( url . includes ( '?' ) ) {
44- url += '&' ;
45- } else {
46- url += '?' ;
47- }
48-
49- url += `history_follow_rename=${ checkbox . checked } ` ;
50- window . location . href = url ;
40+ url . searchParams . set ( 'history_follow_rename' , `${ checkbox . checked } ` ) ;
41+ window . location . replace ( url ) ;
5142 } ) ;
5243}
You can’t perform that action at this time.
0 commit comments