don't have a file locally to generate it, which can happen, for
instance, if StoreRemoteMedia is disabled
$filepath = $file->getPath();
$size = $file->size;
}
- } catch (InvalidFilenameException $e) {
+ // XXX PHP: Upgrade to PHP 7.1
+ // FileNotFoundException | InvalidFilenameException
+ } catch (Exception $e) {
// We don't have a file to display
- return;
+ $this->clientError(_('No such attachment.'), 404);
+ return false;
}
$filename = MediaFile::getDisplayName($file);
throw new ServerException('No File object attached to this ImageFile object.');
}
+ // File not stored locally, can't generate a thumbnail
+ if (empty($this->fileRecord->filename)) {
+ throw new FileNotStoredLocallyException($this->fileRecord);
+ }
+
if ($width === null) {
$width = common_config('thumbnail', 'width');
$height = common_config('thumbnail', 'height');