Page MenuHomePhabricator

rebuildImages.php fails upon odd character sets
Open, MediumPublic

Description

Hi!

I have a proposition to fix line 196 as it will fail if wfLocalFile(...) fails to return an object. In my case, it was due to an odd character in the file name.

Some people might want it to fail with incompatible filenames. In my case, importing images from Wikipedia, I don't want it to stop at every broken filename. So I propose the following, and maybe someone can add some commandline option such as "--skip-unreadable" or similar.

$file = wfLocalFile( $filename );
if (!$file) {
   $this->log ("cannot be read: $filename");
} else {
        if ( !$file->recordUpload( '', '(recovered file$
        false, $timestamp ) )
        {
                $this->log( "Error uploading file $full$
                return;
        }
}

Version: 1.16.x
Severity: minor

Details

Reference
bz27645

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:29 PM
bzimport set Reference to bz27645.
bzimport added a subscriber: Unknown Object (MLST).

Problematic filename:

cannot be read: Eublemma_anachoresis_%28Noctuidae%2C_Eublemminae%29_P1010030.JPG

If you can supply a reasonable patch that does what you want, we'll try to get it applied.