Page MenuHomePhabricator

When inserting an image on a sub-page (Foo/Bar), the target of links in captions link to sibling pages (Foo/Baz) rather than uncle pages (Baz)
Closed, ResolvedPublic1 Estimated Story Points

Description

This only "works" (breaks) on newly inserted images.

  1. "Insert" > "Media".
  2. Choose a file and "Use this image".
  3. Write a caption.
  4. Add a wikilink to the caption ("[[example]]").
  5. Before clicking "Insert" for the image, select the newly created link. Open the link (e.g., right-click the link in the context menu) and open it in a new tab.

Result:

If you start in a /subpage, then the link goes to https://en.wikipedia.org/wiki/User:Whatamidoing_(WMF)/example (case sensitive). Another editor reported a link of en.wikipedia.org/w/linkname instead of en.wikipedia.org/wiki/linkname. See original report.

Event Timeline

Whatamidoing-WMF raised the priority of this task from to Medium.
Whatamidoing-WMF updated the task description. (Show Details)
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Jdforrester-WMF renamed this task from Links in captions for new images don't link to the correct page in the media dialog to When inserting an image on a sub-page (Foo/Bar), the target of links in captions link to sibling pages (Foo/Baz) rather than uncle pages (Baz).Aug 21 2015, 8:15 PM
Jdforrester-WMF set Security to None.
Jdforrester-WMF subscribed.

We fixed this a year ago or so for the main document. Did we forget to do it for images? What about references?

Change 234215 had a related patch set uploaded (by Catrope):
ve.dm.MWImageModel: Require parent document

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

Change 234216 had a related patch set uploaded (by Catrope):
ve.dm.MWReferenceModel: Require parent document

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

We fixed this a year ago or so for the main document. Did we forget to do it for images?

Kind of. It was broken for new images, but it worked for existing images. It even went so far that you could create an image (and see the broken behavior while writing the caption), but if you inserted it and then immediately inspected it, you would see correct behavior: inspecting even a freshly inserted image is enough to send you down the "existing image" code path and avoid the "new image" code path, and only the latter was affected by this bug.

What about references?

Good thinking. ImageModel and ReferenceModel had almost identical bugs, and the user-facing behavior was completely identical (broken for new ones, works for existing ones, even if you created them 3 seconds ago). I wouldn't have noticed that if you hadn't brought it up. You actually primed me into investigating and fixing the reference case first, which then turned out to be almost the same but slightly simpler than the image case.

Change 234215 merged by jenkins-bot:
ve.dm.MWImageModel: Require parent document

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

Change 234216 merged by jenkins-bot:
ve.dm.MWReferenceModel: Require parent document

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