[go: up one dir, main page]

Page MenuHomePhabricator

Image thumbs on Persian Wikipedia broken when you click on them (due to Gadget-Direct-link-to-Commons.js attaching uselang parameter)
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

What happens?:

  • An error occurs: در هنگام بارگذاری این تصویر، خطایی رخ داد ("An error occurred when uploading this image")

What should have happened instead?:
The image box with relevant info and a link to commons should have been shown instead—this happens only on fawiki and for images that are uploaded in commons.

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
Android 13 - Chrome 117
Windows 10 - Chrome 117
How it should look like:

image.png (1×598 px, 461 KB)

How it is on fawiki:

image.png (1×599 px, 78 KB)


I didn't know which tags to use so I'm just using MinervaNeue.

Requirement

Ensure that clicking on image thumbnails on the Persian Wikipedia (fawiki) using the Minerva/mobile site opens the image overlay with relevant information and a link to Commons. Fix the issue caused by the Gadget-Direct-link-to-Commons.js attaching the uselang parameter that breaks this functionality. Conduct exploratory testing on the beta cluster to verify similar functionality.

BDD

gherkin
Feature: Fix Image Thumbnails on Persian Wikipedia

  Scenario: Verify image overlay functionality on beta cluster
    Given the user is on the beta cluster using the mobile site
    When the user clicks on an image thumbnail
    Then the image overlay should open, and the navigation arrows should be functional

  Scenario: Clicking on image thumbnails on fawiki should open the image overlay
    Given the user is on the Persian Wikipedia (fawiki) using the Minerva/mobile site
    When the user clicks on an image thumbnail
    Then the image overlay with relevant information and a link to Commons should appear

Test Steps

Test Case 1: Exploratory Testing on Beta Cluster

  1. Navigate to an article with images on the beta cluster using the mobile site.
  2. Click on an image thumbnail.
  3. AC1: Confirm that the image overlay opens correctly.
  4. Use the arrows within the overlay to navigate between images.
  5. AC2: Confirm that the navigation arrows are functional.

Test Case 2: Verify Image Overlay Opens Correctly on fawiki

  1. Visit an article on the Persian Wikipedia using the mobile site (e.g., گربه or آنجلینا جولی).
  2. Click on an image thumbnail that was uploaded to Commons.
  3. AC3: Confirm that the image overlay opens with relevant information and a link to Commons.
  4. AC4: Ensure no error messages are displayed when clicking the image.

QA Results - Beta

QA Results - PROD

Event Timeline

Looks to fail around here, so tagging Thumbor

normalized_message
TransformationalImageHandler::doTransform: creating 800x525 thumbnail at mwstore://shared-multiwrite/local-thumb/0/0b/Cat_poster_1.jpg/800px-Cat_poster_1.jpg using scaler im

For https://fa.m.wikipedia.org/wiki/%DA%AF%D8%B1%D8%A8%D9%87#/media/File:Cat_poster_1.jpg?uselang=fa, ?uselang=fa is appended to the fragment of the URL, not the query string. MediaViewer then makes an imageinfo API query for File:Cat_poster_1.jpg?uselang=fa, which does not exist.

?uselang=fa is being added by https://fa.wikipedia.org/wiki/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C:Gadget-Direct-link-to-Commons.js . If I had to guess, this is a side effect of T127268: Dismantle ResourceLoader's "targets" system/T328610: Default gadgets to run on mobile as the script still works on desktop. The script is an old copy of https://www.mediawiki.org/wiki/Snippets/Direct_imagelinks_to_Commons with various fixes and changes piled on top. The current version of the script seems to have no effect on Minerva, but also does not include the uselang feature.

The simplest option is probably to only load this script on non-Minerva skins using |skins=vector,vector-2022,monobook,timeless,modern,cologneblue] in the gadget definition.

Aklapper renamed this task from Image thumbs on Persian Wikipedia are broken when you click on them to Image thumbs on Persian Wikipedia broken when you click on them (due to Gadget-Direct-link-to-Commons.js attaching uselang parameter).Oct 16 2023, 9:13 AM

The simplest option is probably to only load this script on non-Minerva skins using |skins=vector,vector-2022,monobook,timeless,modern,cologneblue] in the gadget definition.

Seems like that would be prone to break in future and i'd be worried about it copied to over projects. Seems straightforward enough to fix the gadget so I'll do that later and update here.

After patching the code and on closer inspection this seems to be a bug in MobileFrontend.

When I run the following code, I see that the Thumbnail objects contain the query string in the file path.

mw.mobileFrontend.require('mobile.startup').currentPageHTMLParser().getThumbnails()

I suspect this code is at fault here.
https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/0652ba81c60c25d7714b7e965c251cd415caedda/src/mobile.startup/PageHTMLParser.js#L173C2-L173C2

Patch very much welcome.

Change #1057195 had a related patch set uploaded (by Ebrahim; author: Ebrahim):

[mediawiki/extensions/MobileFrontend@master] Don't involve URL query in finding file path name

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

Change #1057195 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Don't involve URL query in finding file path name

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

Jdlrobson added a subscriber: Ebrahim.

This cannot be easily tested in beta cluster, so for beta cluster we should do some exploratory testing making sure that clicking images on mobile opens the image overlay and the arrows are functional. In production we'll test the gadget issue.

Edtadros subscribed.

Test Result - Beta

Status: ✅ PASS
Environment: Beta
OS: macOS
Browser: Chrome
Device: MS MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Exploratory Testing on Beta Cluster

  1. Navigate to an article with images on the beta cluster using the mobile site.
  2. Click on an image thumbnail.
  3. AC1: Confirm that the image overlay opens correctly.

see AC2

  1. Use the arrows within the overlay to navigate between images.
  2. AC2: Confirm that the navigation arrows are functional.

screenshot 2.mov.gif (972×498 px, 969 KB)

Test Case 2: Verify Image Overlay Opens Correctly on fawiki

  1. Visit an article on the Persian Wikipedia using the mobile site (e.g., گربه or آنجلینا جولی).
  2. Click on an image thumbnail that was uploaded to Commons.
  3. AC3: Confirm that the image overlay opens with relevant information and a link to Commons.

to be tested in prod

  1. AC4: Ensure no error messages are displayed when clicking the image.

to be tested in prod

Test Result - PROD

Status: ✅ PASS
Environment: PROD
OS: macOS
Browser: Chrome
Device: MS MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Exploratory Testing on PRODr

  1. Navigate to an article with images on en Wiki using the mobile site.
  2. Click on an image thumbnail.
  3. AC1: Confirm that the image overlay opens correctly.

see AC2

  1. Use the arrows within the overlay to navigate between images.
  2. AC2: Confirm that the navigation arrows are functional.

2024-09-10_15-54-34.mp4.gif (760×666 px, 3 MB)

Test Case 2: Verify Image Overlay Opens Correctly on fawiki

  1. Visit an article on the Persian Wikipedia using the mobile site (e.g., گربه or آنجلینا جولی).
  2. Click on an image thumbnail that was uploaded to Commons.
  3. AC3: Confirm that the image overlay opens with relevant information and a link to Commons.

//see AC4/

  1. AC4: Ensure no error messages are displayed when clicking the image.

2024-09-10_16-00-27.mp4.gif (688×626 px, 3 MB)