File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change 5555 * @param {string } url - Any URL
5656 */
5757 const rewrite = function ( url ) {
58- let port_part ;
59- if ( location . port . length ) {
60- port_part = ':' + location . port ;
61- } else {
62- port_part = '' ;
63- }
64- return location . protocol + '//' + location . hostname + port_part + location . pathname + '?' + url ;
58+ return location . origin + location . pathname + '?' + url ;
6559 }
6660
6761 /**
116110 // Rewrite links to this document only
117111 if ( ( a [ i ] . protocol + '//' + a [ i ] . hostname + a [ i ] . pathname ) == rawFileUrl ) {
118112 // Then rewrite URL with support for empty anchor
119- a [ i ] . href = location . protocol + '//' + location . hostname + ':' + location . port + location . pathname + location . search + '#' + a [ i ] . hash . substring ( 1 ) ;
113+ a [ i ] . href =
114+ location . origin + location . pathname + location . search
115+ + '#' + a [ i ] . hash . substring ( 1 ) ;
120116 }
121117 // Do not modify external URLs with fragment
122118 } else if ( isGitForgeFileUrl ( href ) && isHtmlUrl ( href ) ) {
You can’t perform that action at this time.
0 commit comments