From 6235bc0f5703f526d66afda74c956069377f6be7 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 13 Jan 2013 22:00:12 +0100 Subject: [PATCH] Fixed TarWriter adding leading slash to filenames --- wcfsetup/install/files/lib/system/io/TarWriter.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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'); -- 2.20.1