fixed attachments lost when converting email to infolog, is_uploaded_file check in egw_vfs::copy_uploaded need to be switched off (plus improved logging)

This commit is contained in:
Ralf Becker 2011-06-29 07:00:09 +00:00
parent 05a3ccb320
commit 5e05030629
2 changed files with 12 additions and 6 deletions

View File

@ -941,6 +941,8 @@ class egw_link extends solink
/**
* Put a file to the corrosponding place in the VFS and set the attributes
*
* Does NO is_uploaded_file check, calling application is responsible for doing that for uploaded files!
*
* @param string $app appname to linke the file to
* @param string $id id in $app
* @param array $file informations about the file in format of the etemplate file-type
@ -961,8 +963,8 @@ class egw_link extends solink
}
if (file_exists($entry_dir) || ($Ok = mkdir($entry_dir,0,true)))
{
$Ok = egw_vfs::copy_uploaded($file, $p=self::vfs_path($app,$id,'',true), $comment);
error_log(__METHOD__."('$app', '$id', ".array2string($file).", '$comment') called egw_vfs::copy('$file[tmp_name]', '$p')=".array2string($Ok));
$Ok = egw_vfs::copy_uploaded($file, $p=self::vfs_path($app,$id,'',true), $comment, false); // no is_uploaded_file() check!
if (!$Ok) error_log(__METHOD__."('$app', '$id', ".array2string($file).", '$comment') called egw_vfs::copy_uploaded('$file[tmp_name]', '$p', '$comment', false)=".array2string($Ok));
}
else
{

View File

@ -1710,10 +1710,14 @@ class egw_vfs extends vfs_stream_wrapper
{
$target = self::concat($target, self::encodePathComponent(is_array($src) ? $src['name'] : basename($tmp_name)));
}
if ($check_is_uploaded_file && !is_uploaded_file($tmp_name) ||
!(self::is_writable($target) || self::is_writable(self::dirname($target))))
if ($check_is_uploaded_file && !is_uploaded_file($tmp_name))
{
if (self::LOG_LEVEL) error_log(__METHOD__."($tmp_name, $target, ".array2string($props).") returning false");
if (self::LOG_LEVEL) error_log(__METHOD__."($tmp_name, $target, ".array2string($props).",$check_is_uploaded_file) returning FALSE !is_uploaded_file()");
return false;
}
if (!(self::is_writable($target) || self::is_writable(self::dirname($target))))
{
if (self::LOG_LEVEL) error_log(__METHOD__."($tmp_name, $target, ".array2string($props).",$check_is_uploaded_file) returning FALSE !writable");
return false;
}
if ($props)
@ -1744,7 +1748,7 @@ class egw_vfs extends vfs_stream_wrapper
self::proppatch($target, $props);
}
$ret = copy($tmp_name,self::PREFIX.$target) ? self::stat($target) : false;
if (self::LOG_LEVEL > 1) error_log(__METHOD__."($tmp_name, $target, ".array2string($props).") returning ".array2string($ret));
if (self::LOG_LEVEL > 1 || !$ret && self::LOG_LEVEL) error_log(__METHOD__."($tmp_name, $target, ".array2string($props).") returning ".array2string($ret));
return $ret;
}
}