Skip to content

Commit

Permalink
Always use lowercase extension name (#5268)
Browse files Browse the repository at this point in the history
  • Loading branch information
810 committed Mar 23, 2017
1 parent 5cd9bae commit 30324cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/libraries/kunena/attachment/attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,13 @@ function upload($key = 'kattachment', $catid = null)
$fileInput['name'] = preg_replace('/[[:space:]]/', '', $fileInput['name']);

$fileNameWithoutExt = JFile::stripExt($fileInput['name']);
$fileNameWithoutExt = strtolower($fileNameWithoutExt);

$fileExt = JFile::getExt($fileInput['name']);
$fileExt = strtolower($fileExt);

$fileNameWithExt = $fileInput['name'];
$fileNameWithExt = strtolower($fileNameWithExt);

if (file_exists($uploadBasePath . $fileInput['name']))
{
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/kunena/upload/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ public function upload($fileInput, $destination, $type = 'attachment')
{
$file = new stdClass;
$file->ext = JFile::getExt($fileInput['name']);
$file->ext = strtolower($file->ext);
$file->size = $fileInput['size'];
$config = KunenaFactory::getConfig();

Expand All @@ -587,7 +588,6 @@ public function upload($fileInput, $destination, $type = 'attachment')
if ($file->isAvatar)
{
$a = array('gif', 'jpeg', 'jpg', 'png');
$file->ext = strtolower($file->ext);

if (!in_array($file->ext, $a, true))
{
Expand Down

0 comments on commit 30324cd

Please sign in to comment.