Page MenuHomePhabricator

Images: Auto-external links to image files display the image inline
Closed, ResolvedPublic

Description

This is one of the more amazing bugs I can recall seeing.

If a page has a plain external link to an image file with no markup, e.g.

http://www.impactwrestling.com/images/stories/galleries/718-title.jpg

Then opening the Visual Editor on that page results in the external link being replaced with an actual fully rendered copy of the image. I haven't the wildest clue why an external link to an image would be translated into HTML markup that displays that image, but that seems to be what is happening.

I tried a few more dangerous file types (e.g. js, css, pdf) and those do not appear to be rendered / included, so apparently it is something specific about external links to image file types.


Version: unspecified
Severity: normal
URL: http://parsoid.wmflabs.org/en/User:Thryduulf/sandbox2?oldid=563640804

Details

Reference
bz51092

Event Timeline

bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz51092.

Confirmed in Firefox 22 for JPG, PNG and SVG files but not for GIF or TIF files

https://en.wikipedia.org/w/index.php?title=User:Thryduulf/sandbox2&oldid=563640804

See also bug 51103 which is likely related to this one.

Turns into the following in Parsoid:

<img rel="mw:externalImage" alt="<filename>" src="<URL>">

Not good.

ok, i'll take this one.

Having spoken to Roan, he says this is caused because he presumes that Parsoid assumes that $wgAllowExternalImages is true - it generally isn't, and certainly isn't in production for Wikimedia. :-)

  • Bug 51103 has been marked as a duplicate of this bug. ***

Hm, but parserTests seem to run with $wgAllowExternalImages=true -- for example:

!! test
External image
!! input
External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
!! result
<p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
</p>
!! end

Change 73111 had a related patch set uploaded by Cscott:
Add wgAllowExternalImages option to parser tests.

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

So I need to export the value of $wgAllowExternalImages in the mediawiki siteinfo in order to parse this correctly.

Alternatively, we could leave parsoid as-is and handle this in VE?

(In reply to comment #9)

So I need to export the value of $wgAllowExternalImages in the mediawiki
siteinfo in order to parse this correctly.

Alternatively, we could leave parsoid as-is and handle this in VE?

I don't think that would be appropriate; VE should not need to know about server configuration items like this, and it'd be an ugly hack to special-case certain kinds of images.

Change 73199 had a related patch set uploaded by Cscott:
Export information about external image settings via siteinfo API.

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

Change 73199 merged by jenkins-bot:
Export information about external image settings via siteinfo API.

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

Change 73111 merged by jenkins-bot:
Add wgAllowExternalImages option to parser tests.

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

Change 74053 had a related patch set uploaded by Cscott:
Handle $wgAllowExternalImages in wiki configuration.

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

Change 74053 merged by jenkins-bot:
Handle $wgAllowExternalImages in wiki configuration.

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