Skip to content
Snippets Groups Projects
Commit 23daa5de authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #568 from greezybacon/issue/mail-parse-file-exts


pipe: Honor attachment ext and size restrictions

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 4e06fe84 7eeec826
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