mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Don't do image stuff with unviewable images
Summary: If a file isn't a viewable image, don't try to figure out metadata (size, etc.) when rendering a `{F...}` tag in Remarkup. Test Plan: Uploaded a .rtf, added it as `{F1}` in a new Maniphest task, saw no errors in the dark console. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2479 Differential Revision: https://secure.phabricator.com/D4837
This commit is contained in:
parent
361ce491f2
commit
fb7d5d17a2
1 changed files with 28 additions and 24 deletions
|
@ -50,7 +50,10 @@ final class PhabricatorRemarkupRuleEmbedFile
|
|||
$file_name = coalesce($options['name'], $file->getName());
|
||||
$options['name'] = $file_name;
|
||||
|
||||
$is_viewable_image = $file->isViewableImage();
|
||||
|
||||
$attrs = array();
|
||||
if ($is_viewable_image) {
|
||||
switch ((string)$options['size']) {
|
||||
case 'full':
|
||||
$attrs['src'] = $file->getBestURI();
|
||||
|
@ -75,12 +78,13 @@ final class PhabricatorRemarkupRuleEmbedFile
|
|||
$options['image_class'] = 'phabricator-remarkup-embed-image';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$bundle['attrs'] = $attrs;
|
||||
$bundle['options'] = $options;
|
||||
|
||||
$bundle['meta'] = array(
|
||||
'phid' => $file->getPHID(),
|
||||
'viewable' => $file->isViewableImage(),
|
||||
'viewable' => $is_viewable_image,
|
||||
'uri' => $file->getBestURI(),
|
||||
'dUri' => $file->getDownloadURI(),
|
||||
'name' => $options['name'],
|
||||
|
|
Loading…
Reference in a new issue