File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -106,15 +106,16 @@ function convertBundleIntoReact(
106
106
let index = 0 ;
107
107
let match : RegExpExecArray | null ;
108
108
while ( ( match = linkRegex . exec ( bundle . content ) ) !== null ) {
109
- const startIndex = match . index + match [ 1 ] . length ;
109
+ const [ , pre , url , post ] = match ;
110
+
111
+ const startIndex = match . index + pre . length ;
110
112
if ( startIndex > index ) {
111
113
content . push ( bundle . content . substring ( index , startIndex ) ) ;
112
114
}
113
115
114
- const link = match [ 2 ] ;
115
116
// Make sure the href we generate from the link is fully qualified. We assume http
116
117
// if it starts with a www because many sites don't support https
117
- const href = link . startsWith ( "www." ) ? `http://${ link } ` : link ;
118
+ const href = url . startsWith ( "www." ) ? `http://${ url } ` : url ;
118
119
content . push (
119
120
React . createElement (
120
121
"a" ,
@@ -123,11 +124,11 @@ function convertBundleIntoReact(
123
124
href,
124
125
target : "_blank"
125
126
} ,
126
- `${ link } `
127
+ `${ url } `
127
128
)
128
129
) ;
129
130
130
- const endIndex = linkRegex . lastIndex - match [ 3 ] . length ;
131
+ const endIndex = linkRegex . lastIndex - post . length ;
131
132
index = endIndex ;
132
133
}
133
134
You can’t perform that action at this time.
0 commit comments