Commons:Village pump/Technical/Archive/2023/07

Determining a file's filetype in wikitext

i'm thinking of adding cats to {{From YouTube}} so that files are automatically separated into images, videos, etc.

what's an easy way to determine filetype?

here's my idea:

  1. use Module:string2 to extract the extension (substring from the right to the rightmost dot, like .jpg, .webm).
  2. use parserfunction switch to change extension to filetype.

RZuo (talk) 14:48, 12 July 2023 (UTC)

There’s already such a template, which works exactly the way you described: {{File type en}}. —Tacsipacsi (talk) 09:07, 13 July 2023 (UTC)
thx a lot. {{File extension}} is a very neat method.--RZuo (talk) 10:36, 13 July 2023 (UTC)
where can we find a full list of possible extensions and their corresponding filetype?
does Template:File type en miss out any extension?--RZuo (talk) 10:36, 13 July 2023 (UTC)
The list of file extensions that can currently be uploaded can be queried from the API: https://commons.wikimedia.org/w/api.php?action=query&meta=siteinfo&siprop=fileextensions&format=xml. However, be aware that there can be files on Commons that have extensions which used to be but are no longer allowed. These can be found only by going through all file names on Commons, which would take quite a long time even by using a direct SQL query. —Tacsipacsi (talk) 12:34, 15 July 2023 (UTC)
thx a lot for this neat list.--RZuo (talk) 12:01, 18 July 2023 (UTC)
  This section is resolved and can be archived. If you disagree, replace this template with your comment. --RZuo (talk) 12:01, 18 July 2023 (UTC)

UK MonthYear template help

Morning all, in my infinite wisdom, I made Template:UKBusmonthyear because I thought it would both aid with navigation throughout a year's worth of bus photos and I thought it would be neat to have a counter per month of how many bus photos were taken without having to step into the year category.

However, I've hit a couple of snags. See, I've based the template off of Template:CountyFermanaghmonthyear (which I'm not exactly sure of the origin template), and in doing so, two issues have cropped up which I've tried and now failed to fix:

Is there any way I can have help fixing this, and in future, what can I do to prevent it? Hullian111 (talk) 08:29, 18 July 2023 (UTC)

@Hullian111: i hope you are satisfied with the fix.--RZuo (talk) 12:01, 18 July 2023 (UTC)
  This section is resolved and can be archived. If you disagree, replace this template with your comment. --RZuo (talk) 12:01, 18 July 2023 (UTC)

Template:Districts of Bangladesh

Hello everyone! I started this template copying Template:Districts of West Bengal. But the code seems not to work. I can't find, where I did the mistake as I am not very familiar with the template structure. Can anyone help to resolve the issue? — Meghmollar2017Talk16:09, 1 July 2023 (UTC)

Tech News: 2023-27

MediaWiki message delivery 22:49, 3 July 2023 (UTC)

Who is able to fix this template? If you take a look at one of the usages, for example in Category:Charlottenburg-Wilmersdorf in the 1900s, there is a red link in the box and a red category at the bottom. It should be "20th century" instead of "20. century". Thanks -2001:4652:FBAF:0:90A5:4807:B2EE:4427 17:39, 31 July 2023 (UTC)

I don’t see a red link nor a red category on Category:Charlottenburg-Wilmersdorf in the 1900s. If they’re still there for you, can you say what they link to? Lucas Werkmeister (talk) 18:47, 31 July 2023 (UTC)
Check it in German: https://commons.wikimedia.org/wiki/Category:Charlottenburg-Wilmersdorf_in_the_1900s?uselang=de-formal (links to Category:Charlottenburg-Wilmersdorf in the 20. century) -2001:4652:FBAF:0:90A5:4807:B2EE:4427 19:41, 31 July 2023 (UTC)
Okay, I see – I think I’ve fixed it now by adding |lang=en to {{Ordinal}}. (CC User:Shāntián Tàiláng who created the template.) Lucas Werkmeister (talk) 21:53, 31 July 2023 (UTC)
  This section is resolved and can be archived. If you disagree, replace this template with your comment. Lucas Werkmeister (talk) 17:26, 1 August 2023 (UTC)

Help with {{odate}} template

Can somebody with experience in templates please edit the {{odate}} to look and function more like the {{autvec}} template, because they have similar functions and can be used together. --QuickQuokka [⁠talkcontribs] 20:15, 5 July 2023 (UTC)

Please help rotate

This version - does not rotate with bot. --Abc10 (talk) 13:28, 8 July 2023 (UTC)

use com:croptool. RZuo (talk) 14:07, 8 July 2023 (UTC)
Could you please help rotate it? --Abc10 (talk) 07:27, 9 July 2023 (UTC)

Error from Deletion Notification Bot 2

In this edit, the Deletion Notification Bot 2 made an error of some sort and didn’t created a new section nor did it complete the template. Technical error of some sort. WeatherWriter (talk) 22:32, 9 July 2023 (UTC)

Looking into it shortly. —‍Mdaniels5757 (talk • contribs) 00:04, 10 July 2023 (UTC)
@WeatherWriter Yeah, it looks like your use of the {{Tq}} template broke it. I would fix the bot, but it also broke the tool used to convert speedy nominations to deletion requests, so I think the better solution is just to not use templates inside deletion reasons :). —‍Mdaniels5757 (talk • contribs) 00:15, 10 July 2023 (UTC)

Tech News: 2023-28

MediaWiki message delivery 19:51, 10 July 2023 (UTC)

Special:Search no longer displays images in a slideshow

More or less as per title. Clicking on an image result in Special:Search takes you directly to that image's page rather than displaying it in a slideshow as it did previously. Category page slideshows still work, as does the equivalent feature in MediaSearch, so surely this can't be intentional behaviour? - Dvaderv2 (talk) 20:14, 10 July 2023 (UTC)

I have now tried this on different machines and browsers and I'm still getting this issue. Moreover, this testing was done without being logged in, so I can rule this out as being an issue specific to my account. --Dvaderv2 (talk) 17:15, 11 July 2023 (UTC)

F2C

It seems that Flickr2Commons has been shut down as I can't upload even a single file. When I try to enter Flickr file ID to the upload tool it only turns to blue but doesn't upload a file! Юрий Д.К 09:57, 11 July 2023 (UTC)

i confirm the problem. it's stuck at the blue phase.
the tool was last working at 13:45, 10 July 2023. RZuo (talk) 13:13, 11 July 2023 (UTC)
use Special:UploadWizard instead. RZuo (talk) 13:14, 11 July 2023 (UTC)
Already notified @Magnus Manske: as the creator of F2C. --A1Cafel (talk) 15:11, 12 July 2023 (UTC)
@Magnus Manske: @RZuo: @A1Cafel: Working now, thanks Юрий Д.К 20:12, 12 July 2023 (UTC)

Hi, please help with the problem presented in PHAB:T341636.
Apparently, it affects all editors whose languages are RTL.
מקףHyphen 14:44, 12 July 2023 (UTC)

Motd/2023-07

Could someone fix the width issue in {{Motd/2023-07}}? Thanks, — Racconish💬 12:56, 15 July 2023 (UTC)

Search / Skip PDFs / Filemime

While doing searches on Commons, I noticed a 'recent' addition in the form of a link labelled "Skip PDFs", which is slightly easier than adding -pdf to my search string. It has unintended consequences, and I can't find a way to report a bug to the relevant originator. For example, if I enter "deer valley" (with double quotes) in the search box, I get all variations of that. If I then click on the Skip PDFs link, in the search string I then get each double quote mark replaced by ampersand hash 34 semicolon which doesn't produce the intended result. PeterWD (talk) 08:57, 15 July 2023 (UTC)

Indeed. You might get more help to fix this problem at Commons:Village pump/Technical. -- Asclepias (talk) 15:47, 15 July 2023 (UTC)
Thanks, but how do I move a discussion without losing formatting, signatures, etc.PeterWD (talk) 08:16, 16 July 2023 (UTC)
You copy-paste the whole think as wikitext and add a note (usually using <small> for the note, and signing it) to indicate you have done so. - Jmabel ! talk 15:00, 16 July 2023 (UTC)
Thanks, now moved from Commons:Help desk. PeterWD (talk) 15:28, 16 July 2023 (UTC)
yall need to help pressure some interface sysop to take action for MediaWiki_talk:Searchmenu-new#Skip_pdfs. RZuo (talk) 16:47, 16 July 2023 (UTC)

GalleryDetails doesn't work

MediaWiki talk:Gadget-GalleryDetails.jsמקףHyphen 13:57, 17 July 2023 (UTC)

Yes, sadly. For a few days now. -- Tuválkin 15:24, 17 July 2023 (UTC)
Is it known what causes this? ‎מקףHyphen 15:56, 17 July 2023 (UTC)

Tech News: 2023-29

MediaWiki message delivery 23:06, 17 July 2023 (UTC)

Old appearance for editor

 

How do I get back the classic old box for editing with "Publish changes" "Show preview" "Show changes" buttons below "Summary"? Commons help sends to Meta and then MediaWiki and there I choose the "[[]]" option under the eye of Visual Editing in the pencil menu, to no avail. I go to my Preferences and I have legacy Vector 2010 and disabled Visual Editor, but nothing. Any idea? Anything to install? ※Sobreira ◣◥ 〒 @「parlez04:02, 30 July 2023 (UTC)

Perhaps a screenshot (on temporary external source) would better help for understanding. Do you speak of the text being coloured? This would be the syntax highlighting with CodeMirror. This image does show it with Chinese text on zhwiki. — Speravir – 23:36, 1 August 2023 (UTC)
@Speravir: Oh, thanks, I was off for a while. I mean the box where you write the text, not the text itself. I uploaded the difference:
 
What I find, it changed a few months ago; to the left of the first blue button there's a pencil and
a "[[]] Source editing" below when you click, but pressing that nothing changes for me. I have a cookie blocker (Ninja cookie) but I disabled it and it's the same.
 
The beloved system that I'd like,
and the only one we used to have.
Sobreira ◣◥ 〒 @「parlez00:13, 11 August 2023 (UTC)
@Sobreira: You need to disable Use the wikitext mode inside the visual editor, instead of a different wikitext editor in PreferencesEditingEditor. —Tacsipacsi (talk) 15:36, 11 August 2023 (UTC)
@Tacsipacsi: Oh, thanks, IT'S DONE, I knew it would be some quick detail I was dumb enough not to find. ※Sobreira ◣◥ 〒 @「parlez23:12, 12 August 2023 (UTC)
  This section is resolved and can be archived. If you disagree, replace this template with your comment. Speravir 00:59, 17 August 2023 (UTC): Thanks Tacsipacsi this has been solved.

Commons:File types needs update

Commons:File types says mpeg is a "Nonfree file format", but some uploads are in this format? e.g. File:4U 1820-30.mpeg, File:Pantun berlirik a-a-a-a.mpg. i have no knowledge about this issue so i dont know how to rewrite the help page. RZuo (talk) 12:13, 18 July 2023 (UTC)

MPEG uploads have been enabled three years ago, after last MPEG patents expired in February 2018. So Commons:File types used to be correct, but isn’t anymore. —Tacsipacsi (talk) 00:58, 19 July 2023 (UTC)
I've updated it in English, German, French, and Spanish. The Squirrel Conspiracy (talk) 03:10, 19 July 2023 (UTC)

Motion Picture Copyright Descriptions Collection, 1912-1977

Tech News: 2023-30

MediaWiki message delivery 02:18, 25 July 2023 (UTC)

Quickfix needed for wrongly rotated file (exif error)

Hi this file shows up right in crop/rotation tool but wrong in description page. Original rotation was wacky in exif and this showed in the loading of the image from right to left. How to fix this and similar halfway incorrect rotations? Thanks. Similar issues from those days in crop tool vs. descr. page. Peli (talk) 22:10, 24 July 2023 (UTC)

Fixed visual part of this case. Peli (talk) 10:57, 25 July 2023 (UTC)

Nie mogę podmienić zdjęcia.

Dobry wieczór. Chciałem podmienić fotografię własnego autorstwa: [10] na inną w lepszej jakości, ale wyskakuje mi komunikat: "If you do not provide suitable license and source information, your upload will be deleted without further notice. Thank you for your understanding". Wbrew temu co mówi komunikat nigdzie nie widzę rubryki na wstawienie jakiejkolwiek informacji licencji fotografii. Prosiłbym o pomoc w tej sprawie. KujKuń (talk) 22:16, 25 July 2023 (UTC)

Annoying confirmation step

When I'm on a Commons file description page, and click on a link, I often (but not always) get a popup as follows:

commons.wikimedia.org

This page is asking you to confirm that you want to leave — information you’ve entered may not be saved.
Leave page Stay on page

I could understand this happening if I was editing the page at the time, but it can happen even when I click the first link on Commons having just arrived from Wikipedia, before I click an edit link. It happens most often when I click the "Original file" link to view the full-size image, but also happens for e.g. links to other files, or category links. It even happens when I click the "Edit" tab. It only happens on Commons but not on other WMF wikis.

Is this a commons feature, or a browser feature? I use Firefox, presently version 115. Is there any way of circumventing it so thT I don't have to keep on clicking that "Leave page" button? --Redrose64 (talk; at English Wikipedia) 13:13, 22 July 2023 (UTC)

This topic was brought up in the discussions earlier with no real outcome for a solution as far as i can remember. Someone checked ... and found ... was still open. Nowadays I (go back &) stay a moment longer on the page and than leave it without the popup, in the hope this fixes this issue for that page for others too. Peli (talk) 19:06, 22 July 2023 (UTC)
I found a persistant one here. Shows the alert upon leaving page Peli (talk) 23:27, 25 July 2023 (UTC)
I have the same problem in Firedox 102.13.0 on Mac when I select a piece of text and then want to leave the page. No problem with Safari 16.5.2. Wouter (talk) 20:33, 28 July 2023 (UTC)

How to deal with seemingly unused gadgets needing an update

There are still some gadgets that have now outdated code after changes according to phab:T314318, see also corresponding FAQ: mw:Parsoid/Parser Unification/Media structure/FAQ #The "image" class is no longer present on file description links.

Some used gadgets already have been updated, but these haven’t yet:

The first one is mentioned in a comment in User:DrTrigon/common.js, but this user is inactive since 2016.

What I cannot estimate, though, are potential external uses. — Speravir – 23:22, 29 July 2023 (UTC)

Tech News: 2023-31

MediaWiki message delivery 23:52, 31 July 2023 (UTC)

Thumbnail displays in special search results shown as squares again ?

Hello the thumbnails in special search results are back to squares for me. I thought we had agreed that this is hindering the oversight and that this new layout was rolled back or disabled generally for commons. lengthy discussion here the big code block with css hack shown there was added to my common.css but stopped working for me since ca. 14 days. What's up with this? In a way the square previews look smooth as a page ... but it hinders mass-reviewing subtle things like sloppy crops around the edges as the discussion shows in examples. And why 'castrate the integrity of each and every image' and discard the basic notion of landscape vs portrait format? So again : how to opt out, please. Thanks. Peli (talk) 19:15, 20 July 2023 (UTC)

I confirm this is happening, to me too, even with the hack added to User:Tuvalkin/common.css. (The one to suppress thumbnails for cats is working, though. -- Tuválkin 01:02, 22 July 2023 (UTC)
Like just about anything that broke on Commons two weeks ago: phab:T314318, specifically mw:Parsoid/Parser Unification/Media structure/FAQ#The "image" class is no longer present on file description links. Replacing .image with .mw-file-description should help. —Tacsipacsi (talk) 22:49, 22 July 2023 (UTC)
Perfect, it works! -- Tuválkin 04:56, 23 July 2023 (UTC)
Yes, confirmed. This hack works. Maybe it should be the default thumbnail layout for everyone on commons or at least be added as an option in user preferences. Thanks Peli (talk) 08:52, 28 July 2023 (UTC)
Moving it to an (opt-in) gadget should be feasible, both technically and organizationally (I fear WMF would object to changing the default), good idea! Unfortunately I can’t do it myself. Hopefully an interface administrator will notice this; if not, you could ping one of them. —Tacsipacsi (talk) 16:13, 28 July 2023 (UTC)
Maybe @Raymond: can help getting this proposal to be installed as an opt-in preference for logged-in users by the tech-team. Eventhough I would not know why other users would only need to see 1/4 of the thumbs in their special-search results. Peli (talk) 16:50, 8 August 2023 (UTC)
@Pelikana Technically I could do. But I am not sure about the process to enable new gadgets. I would propose to ask on Commons:Administrators' noticeboard Raymond (talk) 17:47, 8 August 2023 (UTC)
Ok thank you for the response. Maybe I will wait until the yearly tech wishlist is open again. It's not clear to me why these square thumbs are preferred by the layout team, and set as a default, over just showing complete thumbs. Peli (talk) 18:05, 8 August 2023 (UTC)

RSVG rendering preview on user:Rillke/MwJSBot.js not working

When I preview any SVG using User:Rillke/MwJSBot.js, I don't get the RSVG rendering preview to work. It just shows the default File:Bug blank.svg as if the SVG is broken, but they aren't. Am I the only one having this problem? Jonteemil (talk) 16:48, 23 July 2023 (UTC)

Anyone? Jonteemil (talk) 14:48, 28 July 2023 (UTC)
@Glrx: Can you confirm or disconfirm this? Jonteemil (talk) 19:11, 2 August 2023 (UTC)
@Jonteemil and Rillke:
I've been using User:Rillke/SVGedit.js for a time, but I have not paid much attention to the RSVG rendering. I usually do not hit the preview button. When I do, I'm happy to see a local SVG rendering. RSVG departs from the SVG specification in a few places.
The RSVG preview has not worked in a long time. For example, using SVGedit on File:IPv6 header-en.svg (which specifies a width and height) does not produce an RSVG preview.
If I look at the SVGedit code, line 396 does a fetchPreview(val). I presume that obtains the RSVG rendering. That method probably fails, so line 413 substitutes a PNG rendering of File:Bug blank.svg. (An alternative explanation is the preview method succeeds but line 399 image/jpeg is incorrect and causes a failure. I expect RSVG to return an image/png rather than an image/jpeg. Data URL claims JPEG but is PNG. Another possibility is the line 411 timeout is too short.)
Looking further, fetchPreview sends its request to //convert.toolforge.org/svg2png.php. If I go to that website and issue a request for a large (2199×1477) SVG file, I get a 500 Internal Server Error. If I give it a small file, my computer receives a appropriate PNG. I will guess the endpoint functions for at least some files.
That leads me back to guessing something goes wrong inside of line 397 .done.
Glrx (talk) 20:51, 2 August 2023 (UTC)
@Glrx: Okay, I don't probably use the tool as often as you do but I do it from time to time and I always preview so I don't happen to save anything erroneous. This problem is something that I haven't experienced before so it must be some new change to the code, or the code of another program that the SVGedit tool uses. Do you know of anyone who'd be willing to take a look at fixing this? Jonteemil (talk) 04:46, 3 August 2023 (UTC)
@Jonteemil and Cmglee:
You load SVGedit from Meta:User:Jonteemil/global.js, but you use Cmglee's version at User:Cmglee/SVGedit.js. That's fortunate because Cmglee is still active; Rillke has not edited in some time. You can ask Cmglee to try changing line 401 to use image/png to see if that fixes preview.
Glrx (talk) 05:32, 3 August 2023 (UTC)
Thanks for your clear instructions and analysis, @Glrx: I've changed "jpeg" to "png" but the problem persists. I think rsvg previews are broken as with commons:commons_SVG_Checker. Would you be able to debug why commons:commons_SVG_Checker also gives the bug image? Thanks, cmɢʟee ⋅τaʟκ 15:34, 3 August 2023 (UTC)
@Cmglee:
Thanks for running the test. I'll try looking at the HTTP transfer and see if there are cross origin issues.
The code backing the SVG Checker also uses line 451 image/jpeg:
Thanks again.
Glrx (talk) 17:58, 3 August 2023 (UTC)
image/jpeg likely isn't the issue as it worked before around 2019. Don't know if Commons_talk:Commons_SVG_Checker#is_it_down? is a useful lead. Thanks too for trying, cmɢʟee ⋅τaʟκ 19:23, 3 August 2023 (UTC)
@Cmglee and Jonteemil:
I go to Commons SVG Checker, select an SVG file, and then execute the SVG check.
The request to convert.toolforge.org/svg2png.php fails.
Console reports
Referrer Policy: Ignoring the less restricted referrer policy “origin-when-cross-origin” for the cross-site request: https://convert.toolforge.org/svg2png.php index.php:322:8
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://convert.toolforge.org/svg2png.php. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
The request fails in the browser because the svg2png does not supply an appropriate Access-Control-Allow-Origin header.
Cannot find tool on toolforge.org.
Guess this is the source
This URL should return the version:
svg2png.php line 35 calls matchOrigin($origin) and emits appropriate CORS access headers if there is a match. I'm confused. The access headers were not emitted, but if no match then no PNG should be emitted (exit is called before calling RSVG). A PNG was emitted. Is there another source? Is PHP or something else suppressing the CORS headers?
I cannot find matchOrigin; I expect it to be in shared/commons.php, but that links to Rillke (which is not 2 dirs up).
Interesting GitHub issue re toolforge and wmflabs (apparently fixed by renaming wmflabs URLs to toolforge URLs around 2020).
line 8 uses old URL:
  • $url = $prot . "://tools.wmflabs.org/$tool_user_name/";
but does not seem to be used for matching the origin.
Glrx (talk) 20:36, 3 August 2023 (UTC)
@Jonteemil and Cmglee:
I suspect that is not the current source. I can convert SVG to PNG from a non-WMF origin, so I suspect the current source has deleted not only the origin matching test but also the CORS headers.
Glrx (talk) 21:19, 3 August 2023 (UTC)
@Glrx: Thanks again for investigating. I must admit that your findings are far beyond what I'm familiar with. Pinging @Redrose64: and @JoKalliauer: (may not be active recently) for their opinions, cmɢʟee ⋅τaʟκ 02:22, 4 August 2023 (UTC)
@Cmglee and JoKalliauer:
Turns out that Johannes cloned convert to make his SVG workaround bot. His clone has the matchOrigin code:
I still cannot explain the failure to supply the CORS headers.
Glrx (talk) 04:12, 4 August 2023 (UTC)
 
webservice restart might work
@Glrx and Jonteemil: I do not know why Rillke's rendering does not work, maybe consider reopening phab:T217362.
I assume that Commons:Commons_SVG_Checker might use the same code, which recommends since 2019 to use @Jarry1250: tool: https://svgcheck.toolforge.org/ which works imho flawlessly. (But you have to manually upload the image.)
I assume that
webservice stop
webservice --backend=gridengine start
would fix it, see wikitech:Help:Toolforge/Web. I also sometimes have to restart webservice for https://svgworkaroundbot.toolforge.org/ to work again.
github.com/JoKalliauer/convert doesn't help in this case, it only converts svg to (less buggy) svg, it does not render svg to png, and the issue with User:Rillke/MwJSBot.js is imho independent on the SVG, therefore it won't help. I use Rillke's code basically as black-box without understanding JavaScript, so I won't be helpful in bug fixing the code, or finding the issue.
I'm basically inactive, and stopped following treads, however I'm happy to get pinged to help. :-)
 — Johannes Kalliauer - Talk | Contributions 07:50, 4 August 2023 (UTC)

There should be a Phabricator issue (or equivalent) about this toolforge app. It is used in several places, but the behavior of the installed tool does not match the existing (and incomplete) GitHub source. Furthermore, a modification to the tool source (make the web page display the PNG rather than download it: Content-Disposition header) could avoid a lot of uploads at File:Test.svg. Glrx (talk) 23:40, 18 August 2023 (UTC)

Submitted Phab:T345972 Glrx (talk) 04:27, 9 September 2023 (UTC)

Similar issue at Commons_talk:Commons_SVG_Checker#Previews_aren't_generated. Glrx (talk) 16:57, 8 October 2023 (UTC)