diff --git a/tine20/Tinebase/FileSystem.php b/tine20/Tinebase/FileSystem.php index f51b03781e4..f7cca5aaa32 100644 --- a/tine20/Tinebase/FileSystem.php +++ b/tine20/Tinebase/FileSystem.php @@ -697,7 +697,7 @@ public function fileExists($path, $revision = null) * @param resource $handle * @return boolean */ - public function fclose($handle) + public function fclose($handle, $avscan = true) { if (!is_resource($handle)) { return false; @@ -724,7 +724,7 @@ public function fclose($handle) $hashFile = 'flySystem'; // we need to set a true-ish string value here $avResult = null; // FIXME todo add avScanning for FlySystem } else { - list ($hash, $hashFile, $avResult) = $this->createFileBlob($handle); + list ($hash, $hashFile, $avResult) = $this->createFileBlob($handle, $avscan); } try { @@ -2487,7 +2487,7 @@ public function checkHashFile(string $hash) * @throws Tinebase_Exception_NotImplemented * @throws Tinebase_Exception_UnexpectedValue */ - public function createFileBlob($contents) + public function createFileBlob($contents, $avscan = true) { if (! is_resource($contents)) { throw new Tinebase_Exception_NotImplemented('please implement me!'); @@ -2532,8 +2532,12 @@ public function createFileBlob($contents) } // AV scan - $avResult = $this->avScanHashFile($hashFile); - + if ($avscan) { + $avResult = $this->avScanHashFile($hashFile); + } else { + $avResult = null; + } + $tries = 0; $currentFilesHash = null; $previousCurrentFilesHash = null; diff --git a/tine20/Tinebase/Frontend/WebDAV/Directory.php b/tine20/Tinebase/Frontend/WebDAV/Directory.php index a605233e9c8..8e6c8e66fca 100644 --- a/tine20/Tinebase/Frontend/WebDAV/Directory.php +++ b/tine20/Tinebase/Frontend/WebDAV/Directory.php @@ -176,7 +176,7 @@ public function createFile($name, $data = null) throw new Sabre\DAV\Exception('data should be a resource'); } - if (true !== Tinebase_FileSystem::getInstance()->fclose($handle)) { + if (true !== Tinebase_FileSystem::getInstance()->fclose($handle, false)) { throw new Sabre\DAV\Exception('Tinebase_FileSystem::fclose failed for path ' . $path); } @@ -379,7 +379,7 @@ public static function handleOwnCloudChunkedFileUpload($name, $data) } // combine all chunks to one file - $joinedFile = Tinebase_TempFile::getInstance()->joinTempFiles($uploadedChunks); + $joinedFile = Tinebase_TempFile::getInstance()->joinTempFiles($uploadedChunks, false); $joinedFile->name = $chunkInfo['name']; return $joinedFile; diff --git a/tine20/Tinebase/TempFile.php b/tine20/Tinebase/TempFile.php index 7c1d12120d4..f78bb18fefe 100644 --- a/tine20/Tinebase/TempFile.php +++ b/tine20/Tinebase/TempFile.php @@ -240,7 +240,7 @@ public function createTempFile($_path, $_name = 'tempfile.tmp', $_type = 'unknow * @return Tinebase_Model_TempFile * @throws Tinebase_Exception_Backend */ - public function joinTempFiles($_tempFiles) + public function joinTempFiles($_tempFiles, $avscan = true) { $path = self::getTempPath(); $name = preg_replace('/\.\d+\.chunk$/', '', $_tempFiles->getFirstRecord()->name); @@ -262,8 +262,9 @@ public function joinTempFiles($_tempFiles) fclose($fChunk); } - if (Tinebase_FileSystem_AVScan_Factory::MODE_OFF !== Tinebase_Config::getInstance() + if ($avscan && Tinebase_FileSystem_AVScan_Factory::MODE_OFF !== Tinebase_Config::getInstance() ->{Tinebase_Config::FILESYSTEM}->{Tinebase_Config::FILESYSTEM_AVSCAN_MODE}) { + // fixme: large file might lead to gateway timeout, we wait for the schedular task to scan the large files for now $this->_avScan($fJoin, $path); }