Skip to content

Commit

Permalink
Fixed a bug where sometimes may fail to get file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
dengenxp committed Jan 27, 2017
1 parent 150a48f commit b5d08c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions system/classes/unpacker.class.php
Expand Up @@ -117,7 +117,7 @@ public function open($file, $mimeType = null)
// copy vars
$this->file = $file;
$this->fileSize = filesize($file);
$this->ext = strtolower(substr($file, -4));
$this->ext = substr($file, strrpos($file, '.'));

// if the type is passed, store it
if (!empty($mimeType)) {
Expand All @@ -133,10 +133,10 @@ public function open($file, $mimeType = null)
// mime types are not reliable so this is the recommended way
// for example: unpacker($_FILES['foo']['name'],$type);
// .tar, .tgz, .tar.gz, .tar.bz2, and .tar.bz are supported
if ($this->ext === 'r.gz' || $this->ext === '.tgz') {
if ($this->ext === '.gz' || $this->ext === '.tgz') {
$this->type = 'tar';
$this->comp = 'gz';
} elseif ($this->ext === 'r.bz' || $this->ext === '.bz2') {
} elseif ($this->ext === '.bz' || $this->ext === '.bz2') {
$this->type = 'tar';
$this->comp = 'bz2';
} elseif ($this->ext === '.zip') {
Expand Down

0 comments on commit b5d08c4

Please sign in to comment.