fix: [internal] loading a missing proposal attachment leads to an exception

- should be silently logged and notice error sent
pull/6262/head
iglocska 2020-08-28 16:48:16 +02:00
parent c3d6054409
commit 40c43462a0
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 12 additions and 3 deletions

View File

@ -394,10 +394,19 @@ class ShadowAttribute extends AppModel
return in_array($type, $this->zippedDefinitions) || in_array($type, $this->uploadDefinitions);
}
public function base64EncodeAttachment($attribute)
public function base64EncodeAttachment(array $attribute)
{
$content = $this->loadAttachmentTool()->getShadowContent($attribute['event_id'], $attribute['id']);
return base64_encode($content);
try {
return base64_encode($this->getAttachment($attribute));
} catch (NotFoundException $e) {
$this->log($e->getMessage(), LOG_NOTICE);
return '';
}
}
public function getAttachment($attribute, $path_suffix='')
{
return $this->loadAttachmentTool()->getShadowContent($attribute['event_id'], $attribute['id'], $path_suffix);
}
public function saveBase64EncodedAttachment($attribute)