From: Alexander Ebert Date: Sun, 13 Jan 2013 21:00:12 +0000 (+0100) Subject: Fixed TarWriter adding leading slash to filenames X-Git-Tag: 2.0.0_Beta_1~566^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6235bc0f5703f526d66afda74c956069377f6be7;p=GitHub%2FWoltLab%2FWCF.git Fixed TarWriter adding leading slash to filenames --- diff --git a/wcfsetup/install/files/lib/system/io/TarWriter.class.php b/wcfsetup/install/files/lib/system/io/TarWriter.class.php index 2be3e9f8a0..9056f0b03a 100644 --- a/wcfsetup/install/files/lib/system/io/TarWriter.class.php +++ b/wcfsetup/install/files/lib/system/io/TarWriter.class.php @@ -143,8 +143,9 @@ class TarWriter extends Tar { protected function addFile($filename, $addDir, $removeDir) { $filename = FileUtil::unifyDirSeperator($filename); $storedFilename = $filename; - if (!empty($removeDir)) $storedFilename = StringUtil::replaceIgnoreCase($removeDir, '', $filename); - if (!empty($addDir)) $storedFilename = $addDir . $storedFilename; + if (!empty($removeDir)) $storedFilename = StringUtil::replaceIgnoreCase(FileUtil::addTrailingSlash($removeDir), '', $filename); + if (!empty($addDir)) $storedFilename = FileUtil::addTrailingSlash($addDir) . FileUtil::removeLeadingSlash($storedFilename); + if (is_file($filename)) { // open file $file = new File($filename, 'rb');