diff --git a/resources/dist/index.js b/resources/dist/index.js index 2d2b48438..ef284337e 100644 Binary files a/resources/dist/index.js and b/resources/dist/index.js differ diff --git a/resources/dist/index.js.map.json b/resources/dist/index.js.map.json index bf334a192..77a06865d 100644 Binary files a/resources/dist/index.js.map.json and b/resources/dist/index.js.map.json differ diff --git a/src/title.js b/src/title.js index dffe5709b..c0401dde6 100644 --- a/src/title.js +++ b/src/title.js @@ -12,9 +12,6 @@ const mw = mediaWiki; * @return {string|undefined} */ export function getTitle( href, config ) { - const titleRegex = new RegExp( mw.RegExp.escape( config.get( 'wgArticlePath' ) ) - .replace( '\\$1', '([^?#]+)' ) ); - // Skip every URI that mw.Uri cannot parse let linkHref; try { @@ -33,7 +30,9 @@ export function getTitle( href, config ) { // No query params (pretty URL) if ( !queryLength ) { - const matches = titleRegex.exec( linkHref.path ); + const pattern = mw.RegExp.escape( config.get( 'wgArticlePath' ) ).replace( '\\$1', '([^?#]+)' ), + matches = new RegExp( pattern ).exec( linkHref.path ); + // We can't be sure decodeURIComponent() is able to parse every possible match try { title = matches && decodeURIComponent( matches[ 1 ] );