Skip to content

Commit

Permalink
Fixes #6133 - allows long filenames for TAR archives
Browse files Browse the repository at this point in the history
  • Loading branch information
OctavianC committed Mar 23, 2015
1 parent 5955705 commit f2a3c41
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion libraries/joomla/archive/tar.php
Expand Up @@ -182,6 +182,12 @@ protected function _getTarInfo(& $data)
substr($data, $position)
);
}

/* This variable has been set in the previous loop, meaning that the filename was present in the previous block to allow more than 100 characters - see below */
if (isset($longlinkfilename)) {
$info['filename'] = $longlinkfilename;
unset($longlinkfilename);
}

if (!$info)
{
Expand Down Expand Up @@ -219,6 +225,14 @@ protected function _getTarInfo(& $data)
(($mode & 0x100) ? 'x' : '-') . (($mode & 0x040) ? 'r' : '-') . (($mode & 0x020) ? 'w' : '-') . (($mode & 0x010) ? 'x' : '-') .
(($mode & 0x004) ? 'r' : '-') . (($mode & 0x002) ? 'w' : '-') . (($mode & 0x001) ? 'x' : '-');
}
elseif (chr($info['typeflag']) == 'L' && $info['filename'] == '././@LongLink')
{
/* GNU tar ././@LongLink support - the filename is actually in the contents, setting a variable here so we can test in the next loop */
$longlinkfilename = $contents;

/* And the file contents are in the next block so we'll need to skip this */
continue;
}
else
{
/* Some other type. */
Expand All @@ -232,4 +246,4 @@ protected function _getTarInfo(& $data)

return true;
}
}
}

0 comments on commit f2a3c41

Please sign in to comment.