Page MenuHomePhabricator

External links other than http:// break image captions
Closed, ResolvedPublic

Description

Author: rowan.collins

Description:
An image caption containing a non-http external link (e.g. irc://, https://), of
any kind (free, labelled, bracketted), breaks - the old external link getting
parsed multiple times problem. The only reason http:// links *don't* break is
because there's a special case that temporarily masks them as http-noparse://.
Expanding this masking to all protocols should fix the problem. (Patch follows)


Version: 1.5.x
Severity: major

Details

Reference
bz3090

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:45 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz3090.
bzimport added a subscriber: Unknown Object (MLST).

rowan.collins wrote:

Patch to temporarily mask *all* external links inside image captions

This patch just replaces the http:// -> http-noparse:// mask with one based on
the $wgUrlProtocols regex; it uses UNIQ_PREFIX."NOPARSE" at the beginning so
that the protocol is effectively masked without having to insert text before
the colon (impossible using that regex).

attachment ext-link-mask.patch ignored as obsolete

rowan.collins wrote:

tweaked version; mask all external links, but make sure not to double-mask them

Since this hasn't been committed yet, I'll just add a quick tweak: to avoid the
minor possibility of double-masking a URL somewhere, or some other hideous
confusion of that sort, match a "\b" at the beginning of the URL

attachment ext-link-mask-b.patch ignored as obsolete

rowan.collins wrote:

patch to add a parsertest for this bug

Attached:

rowan.collins wrote:

url masking patch that doesn't choke the patch utility

[Oops - never manually edit a diff file, at least not without either knowing
what you're doing, or testing that it still works as a patch afterwards.
Sorry.]

Attached:

rowan.collins wrote:

I've committed both the parsertest and the fix to CVS HEAD and the 1.5 branch.