Last modified: 2014-09-08 00:28:51 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T46011, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 44011 - Internal page and file links that look like urls render as external links (e.g. [[http://]] or [[file:Example.svg]])
Internal page and file links that look like urls render as external links (e....
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.20.x
All All
: High major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-15 19:49 UTC by Mark A. Hershberger
Modified: 2014-09-08 00:28 UTC (History)
13 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Mark A. Hershberger 2013-01-15 19:49:13 UTC
From https://www.mediawiki.org/wiki/Thread:Project:Support_desk/Uploads_not_working_in_1.20.1/reply_(6)

  I upgraded to MediaWiki 1.20.2 ...
  
  File links are still not rendered correctly. Example: a previously (i.e., before the update to 1.20.1/1.20.2) created link like
  
  [[File:IMG_3334.JPG|thumb]]
  
  is now rendered as
  
  [<a rel="nofollow" class="external autonumber" href="File:IMG_3334.JPG%7Cthumb">[2]</a>]
  
  It seems like File is not recognised as all. The inner brackets are interpreted as a link to an external resource, and the contents are rendered accordingly.

A later post gives this update:

  [Having "file:" in $wgURLProtocols] didn't cause problem until a recent upgrade of the MediaWiki software.... Fixing the last line (the file:// protocol) solved the problem:
Comment 1 Ilmari Karonen 2013-01-17 10:59:55 UTC
Same issue reported in this Stack Overflow thread: http://stackoverflow.com/questions/14375177/mediawiki-upgrade-breaks-file-prefix-but-legacy-image-works
Comment 2 Liangent 2013-01-18 08:49:38 UTC
A git bisect suggests I706acb7a0ae194b50d2318763beae4e5e83671f3 is the cause.
Comment 3 Ilmari Karonen 2013-01-18 09:32:47 UTC
(In reply to comment #2)
> A git bisect suggests I706acb7a0ae194b50d2318763beae4e5e83671f3 is the cause.

That's probably what made the problem more visible, since previously it would've only happened if the "file:" prefix was written in all lowercase.

However, the *real* issue, as I see it, is that "[[foo:bar]]" is parsed as an external link rather than an internal one if "foo:" is both a known URL prefix and a valid namespace.  That's likely to go much deeper.
Comment 4 Ilmari Karonen 2013-01-18 09:41:47 UTC
Actually, on second thoughts, whether "foo:" is a valid namespace or not shouldn't really matter.  What we *should* be doing is to always parse "[[whatever]]" as an internal link, even if "whatever" happens to look like a URL.

Test case (these should all be internal links):

* This works: [[:http://www.example.com/]]
* This doesn't: [[http://www.example.com/]]
* This used to work before MW 1.20: [[Http://www.example.com/]]
Comment 5 Daniel Friesen 2013-01-18 10:28:04 UTC
And problematically I have a feeling that there are wikis depending on the behaviour of [[http://example.com/ Example]].
Comment 6 Andre Klapper 2013-01-21 06:43:19 UTC
Wondering if bug 41584 is related...
Comment 7 Krinkle 2014-06-24 22:21:27 UTC
(In reply to Andre Klapper from comment #6)
> Wondering if bug 41584 is related...

I don't think so.
Comment 8 Matěj Grabovský 2014-06-28 15:54:10 UTC
This is handled in Parser.php around line 2010, removing this block fixes this bug:
> # Don't allow internal links to pages containing
> # PROTO: where PROTO is a valid URL protocol; these
> # should be external links.
> if ( preg_match( '/^(?i:' . $this->mUrlProtocols . ')/', $m[1] ) ) {
> 	$s .= $prefix . '[[' . $line;
> 	wfProfileOut( __METHOD__ . "-misc" );
> 	continue;
> }

(In reply to Ilmari Karonen from comment #4)
> Actually, on second thoughts, whether "foo:" is a valid namespace or not
> shouldn't really matter.  What we *should* be doing is to always parse
> "[[whatever]]" as an internal link, even if "whatever" happens to look like
> a URL.
> 
> Test case (these should all be internal links):
> 
> * This works: [[:http://www.example.com/]]
> * This doesn't: [[http://www.example.com/]]
> * This used to work before MW 1.20: [[Http://www.example.com/]]

According to the comment, this is the expected behaviour.
Comment 9 Gerrit Notification Bot 2014-09-07 15:10:12 UTC
Change 158935 had a related patch set uploaded by Jackmcbarn:
Warn about bug 44011

https://gerrit.wikimedia.org/r/158935
Comment 10 Gerrit Notification Bot 2014-09-07 22:28:24 UTC
Change 158935 merged by jenkins-bot:
Warn about bug 44011

https://gerrit.wikimedia.org/r/158935

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links