https://bugzilla.wikimedia.org/show_bug.cgi?id=30269
--- Comment #10 from Roan Kattouw <[email protected]> 2011-08-13 11:34:19 UTC --- (In reply to comment #9) > (In reply to comment #8) > > Option 1 is to create another version of $this->mUrlProtocols that somehow > > excludes '//'. The way I've done it in my patch is particularly hacky; it > > could > > be done a bit more cleanly in wfUrlProtocols() or something, but I didn't > > feel > > like making that effort today. I think this option, changed to exclude '//' > > in > > a more elegant way, is probably best. > > Yeah, it kinda sucks that wfUrlProtocols returns a string rather than an > array. > Otherwise you could use unset or array_diff here pretty cleanly. > You could use array_diff() inside wfUrlProtocols() to massage $wgUrlProtocols before implode()ing it. That requires a bit more code, though (wfUrlProtocols() caches its return value, so you need to account for that too) and would've modified a second file, so I took the quick&dirty route for this so I could get the point across more quickly. > > Option 2 adds a lookbehind for ^|\W\b to the regex, which insures that free > > URLs are only picked up if they are either at the very beginning of the > > page, > > or are preceded by a non-word character and a word boundary. In practice, > > this > > ensures the URL starts with a word character (because it's preceded by > > \W\b), > > which happens to exclude all protocols except '//'. Not only is this hackier > > than option 1 in principle, it also lets protocol-relative URLs at the very > > start of the page through (oops!). > > To me, this option is a complete non-starter. It'll present all sorts of edge > cases and weirdness. Imagine a template that contains only a protocol-relative > URL being transcluded elsewhere. Will it be linked? Unlinked? Who knows. Yeah, I didn't really realize how bad this was until I wrote the Bugzilla comment, and I didn't think about the template case. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
