summaryrefslogtreecommitdiffstats
path: root/3rdparty
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-10-13 21:01:00 +0200
committerBart Visscher <bartv@thisnet.nl>2012-10-13 21:01:00 +0200
commitfea6ac46ef8d49ce5860979b02faeb60be845865 (patch)
tree7eea540d4f1bcc495c8ed71721cde8e86d05f8f1 /3rdparty
parent3fef4564f0be9c3b0e3651d13b6e8312cd90f7a8 (diff)
downloadnextcloud-server-fea6ac46ef8d49ce5860979b02faeb60be845865.tar.gz
nextcloud-server-fea6ac46ef8d49ce5860979b02faeb60be845865.zip
Change the Archive_Tar _addFile function to make it possible to use a different filename
Diffstat (limited to '3rdparty')
-rw-r--r--3rdparty/Archive/Tar.php45
1 files changed, 24 insertions, 21 deletions
diff --git a/3rdparty/Archive/Tar.php b/3rdparty/Archive/Tar.php
index 33c7d395d09..fd2d5d7d9b8 100644
--- a/3rdparty/Archive/Tar.php
+++ b/3rdparty/Archive/Tar.php
@@ -981,7 +981,7 @@ class Archive_Tar extends PEAR
// }}}
// {{{ _addFile()
- function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir)
+ function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $v_stored_filename=null)
{
if (!$this->_file) {
$this->_error('Invalid file descriptor');
@@ -993,28 +993,31 @@ class Archive_Tar extends PEAR
return false;
}
- // ----- Calculate the stored filename
- $p_filename = $this->_translateWinPath($p_filename, false);;
- $v_stored_filename = $p_filename;
- if (strcmp($p_filename, $p_remove_dir) == 0) {
- return true;
- }
- if ($p_remove_dir != '') {
- if (substr($p_remove_dir, -1) != '/')
- $p_remove_dir .= '/';
+ // ownCloud change to make it possible to specify the filename to use
+ if(is_null($v_stored_filename)) {
+ // ----- Calculate the stored filename
+ $p_filename = $this->_translateWinPath($p_filename, false);
+ $v_stored_filename = $p_filename;
+ if (strcmp($p_filename, $p_remove_dir) == 0) {
+ return true;
+ }
+ if ($p_remove_dir != '') {
+ if (substr($p_remove_dir, -1) != '/')
+ $p_remove_dir .= '/';
- if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
- $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
- }
- $v_stored_filename = $this->_translateWinPath($v_stored_filename);
- if ($p_add_dir != '') {
- if (substr($p_add_dir, -1) == '/')
- $v_stored_filename = $p_add_dir.$v_stored_filename;
- else
- $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
- }
+ if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
+ $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
+ }
+ $v_stored_filename = $this->_translateWinPath($v_stored_filename);
+ if ($p_add_dir != '') {
+ if (substr($p_add_dir, -1) == '/')
+ $v_stored_filename = $p_add_dir.$v_stored_filename;
+ else
+ $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
+ }
- $v_stored_filename = $this->_pathReduction($v_stored_filename);
+ $v_stored_filename = $this->_pathReduction($v_stored_filename);
+ }
if ($this->_isArchive($p_filename)) {
if (($v_file = @fopen($p_filename, "rb")) == 0) {