Page MenuHomePhabricator

Graph extension should exclude scripts tags so they will not be parsed by TextExtracts
Closed, DuplicatePublic

Description

Graph extension creates script nodes in its HTML output, which seem to get extracted as if they were text by Hovercards:

Screenshot 2015-07-15 13.44.24.png (686×888 px, 31 KB)

The graphs extension can avoid this by adding a class to the script nodes and making sure this is listed in the config option ExtractsRemoveClasses

Event Timeline

brion raised the priority of this task from to Needs Triage.
brion updated the task description. (Show Details)
brion added a subscriber: brion.

Indeed it looks like everything between parentheses has been stripped as if it were text.
rEPOPb587fcda2055: render.article: Remove text inside brackets along with the brackets

But if it isn't MediaWiki-extensions-Graph's fault, it's almost certainly TextExtracts'.

Only a problem if you don't have graphoid running right ?

Only a problem if you don't have graphoid running right ?

That bit of JS is actually the output for the graphoid-generated fallback image. :D Graph uses inline document.write and a noscript element to insert an img element if necessary (but not always when necessary). It's kind of scary.

Only a problem if you don't have graphoid running right ?

That bit of JS is actually the output for the graphoid-generated fallback image. :D Graph uses inline document.write and a noscript element [..] kind of scary.

See also T107976.

Jdlrobson added a subscriber: Jdlrobson.

How can I replicate this? Could you give me a sample article and api call?
Is this still a problem?

Steps to repro:

  • set up a wiki, install graph & popups
  • create a page that has a graph right at the beginning of the page
  • link to that page
  • hover cursor over the link

Thanks @brion is this all graphs generated or just with specific parameters. (Note to future bug fixer you will have to dig through https://www.mediawiki.org/wiki/Extension:Graph to see how to generate graph)

Should be any graph, as it's the JS preamble with the data trigger that's showing up. My test wiki at the time had a copy of one of the samples, I think the Adams chart: https://www.mediawiki.org/wiki/Extension:Graph/Demo#Graph_data_from_a_URL

Does this happen if RESTBase is used? If we switch to HTML previews this would go away.

Jdlrobson renamed this task from Hovercards can show JavaScript output by Graph extension to Graph extension should exclude scripts tags so they will not be parsed by TextExtracts.Jun 5 2017, 6:27 PM
Jdlrobson updated the task description. (Show Details)