Skip to content
Snippets Groups Projects
Commit 7eeec826 authored by Jared Hancock's avatar Jared Hancock
Browse files

pipe: Honor attachment ext and size restrictions

parent 08904814
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,15 @@ class TicketApiController extends ApiController {
if(!($attachment['data'] = base64_decode($attachment['data'], true)))
$attachment['error'] = sprintf('%s: Poorly encoded base64 data', Format::htmlchars($attachment['name']));
}
if (!$attachment['error']
&& ($size = $ost->getConfig()->getMaxFileSize())
&& ($fsize = $attachment['size'] ?: strlen($attachment['data']))
&& $fsize > $size) {
$attachment['error'] = sprintf('File %s (%s) is too big. Maximum of %s allowed',
Format::htmlchars($attachment['name']),
Format::file_size($fsize),
Format::file_size($size));
}
}
unset($attachment);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment