Page MenuHomePhabricator

Unable to show preview on https://www.mediawiki.org/w/index.php?title=Help:Extension:Translate/Group_configuration&veaction=editsource
Open, Needs TriagePublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

What happens?:
Infinite loader with the following in the developer console:

jQuery.Deferred exception: URI malformed URIError: URI malformed
    at decodeURIComponent (<anonymous>)
    at Function.Uri.decode (https://www.mediawiki.org/w/load.php?debug=1&lang=en&modules=ext.centralNotice.choiceData%2CgeoIP%2CstartUp%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.discussionTools.init%7Cext.echo.api%2Cinit%7Cext.eventLogging%2CnavigationTiming%2CwikimediaEvents%7Cext.translate.edit.documentation%7Cext.translate.pagetranslation.uls%7Cext.uls.common%2Ccompactlinks%2Ci18n%2Cinterface%2Clanguagenames%2Cmediawiki%2Cmessages%2Cpreferences%2Cwebfonts%7Cjquery%2Cmoment%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%2Crangefix%2Csite%7Cjquery.client%2Ccookie%2Ci18n%2Cspinner%2CtextSelection%2Culs%7Cjquery.spinner.styles%7Cjquery.uls.data%2Cgrid%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cnotification%2Cstorage%2Ctoc%2Cuser%2Cutil%2CvisibleTimeout%7Cmediawiki.ForeignApi.core%7Cmediawiki.action.view.postEdit%7Cmediawiki.editfont.styles%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.page.watch.ajax%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.indicators%7Cskins.vector.js%7Cuser.defaults%7Cwikibase.client.linkitem.init&skin=vector&version=2wlvn:13811:11)
    at Uri.parse (https://www.mediawiki.org/w/load.php?debug=1&lang=en&modules=ext.centralNotice.choiceData%2CgeoIP%2CstartUp%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.discussionTools.init%7Cext.echo.api%2Cinit%7Cext.eventLogging%2CnavigationTiming%2CwikimediaEvents%7Cext.translate.edit.documentation%7Cext.translate.pagetranslation.uls%7Cext.uls.common%2Ccompactlinks%2Ci18n%2Cinterface%2Clanguagenames%2Cmediawiki%2Cmessages%2Cpreferences%2Cwebfonts%7Cjquery%2Cmoment%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%2Crangefix%2Csite%7Cjquery.client%2Ccookie%2Ci18n%2Cspinner%2CtextSelection%2Culs%7Cjquery.spinner.styles%7Cjquery.uls.data%2Cgrid%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cnotification%2Cstorage%2Ctoc%2Cuser%2Cutil%2CvisibleTimeout%7Cmediawiki.ForeignApi.core%7Cmediawiki.action.view.postEdit%7Cmediawiki.editfont.styles%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.page.watch.ajax%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.indicators%7Cskins.vector.js%7Cuser.defaults%7Cwikibase.client.linkitem.init&skin=vector&version=2wlvn:13890:25)
    at new Uri (https://www.mediawiki.org/w/load.php?debug=1&lang=en&modules=ext.centralNotice.choiceData%2CgeoIP%2CstartUp%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.discussionTools.init%7Cext.echo.api%2Cinit%7Cext.eventLogging%2CnavigationTiming%2CwikimediaEvents%7Cext.translate.edit.documentation%7Cext.translate.pagetranslation.uls%7Cext.uls.common%2Ccompactlinks%2Ci18n%2Cinterface%2Clanguagenames%2Cmediawiki%2Cmessages%2Cpreferences%2Cwebfonts%7Cjquery%2Cmoment%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%2Crangefix%2Csite%7Cjquery.client%2Ccookie%2Ci18n%2Cspinner%2CtextSelection%2Culs%7Cjquery.spinner.styles%7Cjquery.uls.data%2Cgrid%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cnotification%2Cstorage%2Ctoc%2Cuser%2Cutil%2CvisibleTimeout%7Cmediawiki.ForeignApi.core%7Cmediawiki.action.view.postEdit%7Cmediawiki.editfont.styles%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.page.watch.ajax%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.indicators%7Cskins.vector.js%7Cuser.defaults%7Cwikibase.client.linkitem.init&skin=vector&version=2wlvn:13732:11)
    at https://www.mediawiki.org/w/extensions/VisualEditor/modules/ve-mw/preinit/ve.utils.parsoid.js?7a679:113:18
    at NodeList.forEach (<anonymous>)
    at Object.mw.libs.ve.fixFragmentLinks (https://www.mediawiki.org/w/extensions/VisualEditor/modules/ve-mw/preinit/ve.utils.parsoid.js?7a679:112:26)
    at VeUiMwSaveDialog.ve.ui.MWSaveDialog.showPreview (https://www.mediawiki.org/w/extensions/VisualEditor/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js?f3297:276:14)
    at https://www.mediawiki.org/w/extensions/VisualEditor/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js?97d70:846:22
    at mightThrow (https://www.mediawiki.org/w/resources/lib/jquery/jquery.js?28492:3766:29) undefined

What should have happened instead?:
Preview

Event Timeline

matmarex added a subscriber: matmarex.

mw.libs.ve.fixFragmentLinks crashes in the mw.Uri constructor, because the page has a link to https://github.com/lonvia/waymarked-trails-site/blob/master/django/%FILE%#L%LINE%. The percent signs look like percent-encoding, but they're not, which confuses mw.Uri.

We probably don't even need to use mw.Uri there. We could find and fix the fragment part of the URL with some regexes.