Page MenuHomePhabricator

[BUG] SVGTranslate does not properly handle some characters in file names
Open, Needs TriagePublicBUG REPORT

Description

What is the problem?

SVGTranslate does not handle SVG file names with the characters %, &, = or ?. See example file in reproduction steps.

It causes

  • errors while fetching previews
  • errors attempting to upload translations
  • an invalid "View on Commons" link.

(Possibly other issues, I have not explored exhaustively).

It is possible to create files on Commons with these characters in their names (e.g. see file in reproduction steps). So, SVGTranslate should support them.

The fix may be as simple as percentage-encoding those characters.

Steps to reproduce problem
  1. Open https://svgtranslate-test.toolforge.org/File:%25!-%22%24%26'()*,---.--0-9-;=%3F@A-Z----%5E_%60a-z~%C2%80%C3%BF.svg

Expected behavior: Page should load fine
Observed behavior: You will probably immediately see a pop-up error, while the application is attempting to fetch a preview

  1. Click "View on Commons"

Expected behavior: Takes you to this file on Commons
Observed behavior: You will get a "400 Bad Request" from nginx

  1. Attempt to upload a translation

Expected behavior: Translation is uploaded.
Observed behavior: Will see: The title "File:%!-"$&'()*,---.--0-9-;=?@A-Z----^ a-z~€ÿ.svg" has been banned from creation. It matches the following excluded entries: ".*[?&]+[^=]+=[^&]+.*". This is Commons preventing the creation of the file because it has invalid characters.