Page MenuHomePhabricator

Main ref lost when pasting a sub-ref between articles with colliding ref names (M)
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue
  • Start with two pages with the following Wikitext
<ref name="book" details="page 1">Miller</ref>

And

<ref name="book">Smith</ref>
  • Open the pages in VE in different tabs
  • Copy the Miller sub-ref from one tab into the other
  • Preview the Wikitext changes
What happens?:
  • The sub-ref will be added as [2.1]
  • The reflist does not change
  • Wikitext of the sub-ref is <ref name="book" details="page 1">page 1</ref>
What should have happened instead?:
  • You see a new main ref with Miller having a sub-ref with page 1
  • Wikitext of the sub-ref is <ref name="book2" details="page 1">Miller</ref> ( book2 is a name that does not collide with an existing one )
Solution

There's code in ve.dm.MWReferenceNode.static.remapInternalListKeys that's called when new ReferenceNodes are merged into an existing document where there are other ReferenceNodes already. The code should make sure, that there's no naming conflict between the new nodes and the existing ones.

This method needs to make sure that the remapping also happens for mainListKey and not only for the listKey

Tests

We should add at least two test to ve.ce.ClipboardHandler.test.js where a sub-ref is inserted into a document with sub-ref or with main ref and colliding names.

Event Timeline

MareikeHeuerWMDE renamed this task from Main ref lost when pasting a sub-ref between articles with colliding ref names to Main ref lost when pasting a sub-ref between articles with colliding ref names (M).Aug 31 2026, 10:00 AM