Page MenuHomePhabricator

VisualEditor: mailto: links are saved with double brackets when pasted, instead of the required single bracket
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

What happens?:

  • Link is saved as a piped double-bracket

What should have happened instead?:

Event Timeline

Weird, it looks like it's treated as an internal link by our code. It should be treated as an external one and removed when pasting (except on officewiki where we allowed it in rOMWC6498d6c7a4af: VisualEditor: Allow external link paste on officewiki).

@matmarex Additional context: officewiki was where I first noticed the problem, (in content that was moved from this page into that page), so I attempted to reproduce elsewhere. I hope that helps narrow it down!

I am having the same issue. Toggling $wgVisualEditorAllowExternalLinkPaste did not change anything.

Apparently the "HTML to WikiText" conversion detects the "mailto:" pseudo protocol as valid wiki namespace prefix "Mailto:" and therefore creates an internal instead of an external link in VEs document model.

Change 775290 had a related patch set uploaded (by Robert Vogel; author: Robert Vogel):

[mediawiki/extensions/VisualEditor@master] Check for external url protocols during conversion

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

Can someone give me a hint why CI tests complain about accessing ve object? Is this type of access wrong? What would be the recommended way?

I wanted to add a test case but the related code lives in "wikimedia/VisualEditor" [1] (base application), rather than in "wikimedia/mediawiki-extensions-VisualEditor" (MediaWiki integration). What should I do?

[1] in file tests/ce/ve.ce.Surface.test.js

Sorry for late reply.

Can someone give me a hint why CI tests complain about accessing ve object? Is this type of access wrong? What would be the recommended way?

The file that you were editing (modules/ve-mw/preinit/ve.utils.parsoid.js) can be used before loading the rest of the VisualEditor code that defines ve, or without loading it at all.

I wanted to add a test case but the related code lives in "wikimedia/VisualEditor" [1] (base application), rather than in "wikimedia/mediawiki-extensions-VisualEditor" (MediaWiki integration). What should I do?

[1] in file tests/ce/ve.ce.Surface.test.js

There are also tests for MediaWiki-specific pasting behavior in [mediawiki/extensions/VisualEditor] /modules/ve-mw/tests/ce/ve.ce.Surface.test.js.

Or you could add tests for the ve.utils.parsoid.js library in modules/ve-mw/tests/preinit/ve.utils.parsoid.test.js.

Thanks! I have now added both tests. The ve.utils.parsoid.test.js pass, but the ve.ce.Surface.test.js fail for some odd reason

15:20:37 FAILED TESTS:
15:20:37   ve.ce.Surface (MW)
15:20:37     ✖ beforePaste/afterPaste
15:20:37       Chrome Headless 90.0.4430.212 (Linux x86_64)
15:20:37     "mailto:" pseudo protocol not recognized: HTML
15:20:37     Expected: "<p>Lorem <img class=\"ve-ce-nail ve-ce-nail-pre-open\"><a rel=\"mw:ExtLink\" href=\"mailto:someone@somewhere.net\" class=\"external text ve-ce-annotation ve-ce-nailedAnnotation ve-ce-linkAnnotation\" title=\"mailto:someone@somewhere.net\"><img class=\"ve-ce-nail ve-ce-nail-post-open\">ipsum<img class=\"ve-ce-nail ve-ce-nail-pre-close\"></a><img class=\"ve-ce-nail ve-ce-nail-post-close\"> dolor sit amet</p>"
15:20:37     Actual: "<p>Lorem ipsum dolor sit amet</p>"
15:20:37         at http://localhost:9876/load.php?modules=test.Cite%2CMediaWiki%2CTemplateData%2CVisualEditor%7CtreeDiffer%2Cunicodejs&version=86tmn:1114:882
15:20:37         at fire (http://localhost:9876/load.php?modules=jquery%7Cmediawiki.base&version=jxsku:46:934)
15:20:37         at fireWith (http://localhost:9876/load.php?modules=jquery%7Cmediawiki.base&version=jxsku:48:135)
15:20:37         at mightThrow (http://localhost:9876/load.php?modules=jquery%7Cmediawiki.base&version=jxsku:50:487)
15:20:37         at process (http://localhost:9876/load.php?modules=jquery%7Cmediawiki.base&version=jxsku:50:544)

Apparently the link is not even recognized. I am probably doing something wrong with the input of the test. Can you please help?

The link is probably getting removed because mw.config.get('wgVisualEditorConfig').allowExternalLinkPaste defaults to false. We should probably refactor a bit so that individual tests can change this behavior… I'll take a look.

Change 779102 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[VisualEditor/VisualEditor@master] Allow testing import rules in ve.ce.Surface paste tests

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

Change 779102 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] Allow testing import rules in ve.ce.Surface paste tests

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

Change 784792 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (6609cde00)

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

Change 784792 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (6609cde00)

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

Change 775290 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Check for external url protocols during conversion

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

matmarex moved this task from Inbox to QA on the Editing-team (Kanban Board) board.
matmarex edited projects, added Editing QA; removed Patch-For-Review.

Thanks for working on this @Osnard!

Welcome! Thank you guys for the support with the testing.

ppelberg claimed this task.