forked from GNUsocial/gnu-social
File::processNew can return -1 which was not true for empty()
Also, File->getEnclosure() now throws exception if not enough metadata.
This commit is contained in:
@@ -364,16 +364,13 @@ class File extends Managed_DataObject
|
||||
Event::handle('FileEnclosureMetadata', array($this, &$enclosure));
|
||||
}
|
||||
}
|
||||
if (empty($enclosure->mimetype)) {
|
||||
// This means we don't know what it is, so it can't be an enclosure!
|
||||
throw new ServerException('Unknown enclosure mimetype, not enough metadata');
|
||||
}
|
||||
return $enclosure;
|
||||
}
|
||||
|
||||
// quick back-compat hack, since there's still code using this
|
||||
function isEnclosure()
|
||||
{
|
||||
$enclosure = $this->getEnclosure();
|
||||
return !empty($enclosure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachment's thumbnail record, if any.
|
||||
* Make sure you supply proper 'int' typed variables (or null).
|
||||
|
Reference in New Issue
Block a user