Page MenuHomePhabricator

ForeignAPIRepo doesn't handle files that have no preview
Closed, ResolvedPublic

Description

When trying to use an audio file such as [[File:Four Inventions.ogg]] from the foreignAPIRepo (Commons specifically), in my own installation of MediaWiki, the following error is produced:

[client ::1] PHP Warning: file_put_contents(/Users/hartman/Development/phase3/images/thumb/Accordian_chords-01.ogg/): failed to open stream: Is a directory in /Users/hartman/Development/phase3/includes/filerepo/ForeignAPIRepo.php on line 210, referer: http://localhost/wiki/index.php?title=Main_Page&action=edit

A thumb reports: "Error creating thumbnail:", while a noicon inclusion simply creates a redlink.


Version: unspecified
Severity: normal

Details

Reference
bz22537

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:59 PM
bzimport set Reference to bz22537.

Created attachment 7127
fix thumbs for audio using foreignapirepo

ForeignApiFile is based on File of course.

File has createThumb()
When no error can be created this returns '' otherwise it returns $thumb->getURL()

The problem is in transform() of ForeignApiFile, which returns 'false' when no thumb can be found. However in the case of an audio file, this is not correct. A thumburl should always be present, or it should render the fullsize version from the original server. Instead of returning false, we pass the invalid thumbUrl value to getTransform, so we get a proper ThumbnailImage returned.

There might be better ways to fix this, but I don't know enough about the File code.

Attached:

Demon, Tim thought that you were the best person to look into this.