File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ export default React.forwardRef((props, ref) => {
2626 </ Link >
2727 ) ;
2828 } else {
29- const href = absolutePath ? url . toString ( ) : cleanDuplicateSlash ( getBasename ( ) + url . toString ( ) ) ;
29+ // Note: + '/' + is required here
30+ const href = absolutePath ? url . toString ( ) : cleanDuplicateSlash ( getBasename ( ) + '/' + url . toString ( ) ) ;
3031 return (
3132 < Link ref = { ref } target = "_blank" href = { href } >
3233 { rest . children }
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ export function fetchWithContext(
4141 } ) ;
4242}
4343
44+ /**
45+ * @param {string } path
46+ * @returns path with '/' not duplicated, except at ://
47+ *
48+ */
4449export function cleanDuplicateSlash ( path ) {
45- return path . replace ( / ( [ ^ : ] \/ ) \/ + / g, "$1" ) ;
50+ return path . replace ( / ( : \/ \/ ) \/ * | ( \/ ) + / g, "$1$2 " ) ;
4651}
You can’t perform that action at this time.
0 commit comments