From 3cb666ad7732cd2bff5cc172e40d1b22407aa640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 21 Oct 2013 13:21:39 +0200 Subject: [PATCH 1/7] chunked files are assembled into a part file on the target storage followed by an atomic rename operation. --- lib/private/connector/sabre/file.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 3402946a13..85b67e6587 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -223,9 +223,22 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D } if ($chunk_handler->isComplete()) { - $newPath = $path . '/' . $info['name']; - $chunk_handler->file_assemble($newPath); - return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath); + + // we first assembly the target file as a part file + $partFile = $path . '/' . $info['name'] . '-' . $info['transferid'] . '.part'; + $chunk_handler->file_assemble($partFile); + + // here is the final atomic rename + $fs = $this->getFS(); + $targetPath = $path . '/' . $info['name']; + $renameOkay = $fs->rename($partFile, $targetPath); + $fileExists = $fs->file_exists($targetPath); + if ($renameOkay === false || $fileExists === false) { + \OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR); + $fs->unlink($targetPath); + throw new Sabre_DAV_Exception(); + } + return OC_Connector_Sabre_Node::getETagPropertyForPath($targetPath); } return null; From 2628601e79b8bebfdd6b1a03ef915ca9b1bd629a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 21 Oct 2013 15:00:28 +0200 Subject: [PATCH 2/7] adding oc-mtime handling to chunked upload --- lib/private/connector/sabre/file.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 85b67e6587..8621b7f368 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -238,6 +238,15 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D $fs->unlink($targetPath); throw new Sabre_DAV_Exception(); } + + // allow sync clients to send the mtime along in a header + $mtime = OC_Request::hasModificationTime(); + if ($mtime !== false) { + if($fs->touch($this->path, $mtime)) { + header('X-OC-MTime: accepted'); + } + } + return OC_Connector_Sabre_Node::getETagPropertyForPath($targetPath); } From 68f3f2e691a254349efb1f15953659b42ce8ad3e Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 11 Nov 2013 17:47:46 +0100 Subject: [PATCH 3/7] make it possible to detect transferID part --- lib/private/connector/sabre/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 8621b7f368..cec3c0ed7e 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -225,7 +225,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D if ($chunk_handler->isComplete()) { // we first assembly the target file as a part file - $partFile = $path . '/' . $info['name'] . '-' . $info['transferid'] . '.part'; + $partFile = $path . '/' . $info['name'] . '.ocTransferId' . $info['transferid'] . '.part'; $chunk_handler->file_assemble($partFile); // here is the final atomic rename From 802213f7ecf925ff3f63c2198dde4d63fce16846 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 11 Nov 2013 17:47:59 +0100 Subject: [PATCH 4/7] let encryption app detect transfer id in path and handle it correctly --- apps/files_encryption/lib/helper.php | 27 +++++++++++++++++ apps/files_encryption/lib/keymanager.php | 38 ++++-------------------- apps/files_encryption/lib/util.php | 5 +--- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index a754f9f28c..98a5f1f2f2 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -157,6 +157,33 @@ class Helper { } + /** + * @brief Remove .path extension from a file path + * @param string $path Path that may identify a .part file + * @return string File path without .part extension + * @note this is needed for reusing keys + */ + public static function fixPartialFilePath($path) { + $extension = pathinfo($path, PATHINFO_EXTENSION); + + if ( $extension === 'part' || $extension === 'etmp') { + + $newLength = strlen($path) - 5; // 5 = strlen(".part") = strlen(".etmp") + $fPath = substr($path, 0, $newLength); + + // if path also contains a transaction id, we remove it too + $extension = pathinfo($fPath, PATHINFO_EXTENSION); + if(substr($extension, 0, 12) === 'ocTransferId') { // 12 = strlen("ocTransferId") + $newLength = strlen($fPath) - strlen($extension) -1; + $fPath = substr($fPath, 0, $newLength); + } + return $fPath; + + } else { + return $path; + } + } + /** * @brief disable recovery * diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php index 7143fcff0f..578d8965b4 100755 --- a/apps/files_encryption/lib/keymanager.php +++ b/apps/files_encryption/lib/keymanager.php @@ -155,7 +155,7 @@ class Keymanager { if (self::isPartialFilePath($targetPath)) { $result = $view->file_put_contents( - $basePath . '/' . self::fixPartialFilePath($targetPath) . '.key', $catfile); + $basePath . '/' . \OCA\Encryption\Helper::fixPartialFilePath($targetPath) . '.key', $catfile); } else { @@ -169,29 +169,6 @@ class Keymanager { } - /** - * @brief Remove .path extension from a file path - * @param string $path Path that may identify a .part file - * @return string File path without .part extension - * @note this is needed for reusing keys - */ - public static function fixPartialFilePath($path) { - - if (preg_match('/\.part$/', $path) || preg_match('/\.etmp$/', $path)) { - - $newLength = strlen($path) - 5; - $fPath = substr($path, 0, $newLength); - - return $fPath; - - } else { - - return $path; - - } - - } - /** * @brief Check if a path is a .part file * @param string $path Path that may identify a .part file @@ -199,14 +176,11 @@ class Keymanager { */ public static function isPartialFilePath($path) { - if (preg_match('/\.part$/', $path) || preg_match('/\.etmp$/', $path)) { - + $extension = pathinfo($path, PATHINFO_EXTENSION); + if ( $extension === 'part' || $extension === 'etmp') { return true; - } else { - return false; - } } @@ -226,7 +200,7 @@ class Keymanager { $util = new Util($view, \OCP\User::getUser()); list($owner, $filename) = $util->getUidAndFilename($filePath); - $filename = self::fixPartialFilePath($filename); + $filename = \OCA\Encryption\Helper::fixPartialFilePath($filename); $filePath_f = ltrim($filename, '/'); // in case of system wide mount points the keys are stored directly in the data directory @@ -386,7 +360,7 @@ class Keymanager { // try reusing key file if part file if (self::isPartialFilePath($shareKeyPath)) { - $writePath = $basePath . '/' . self::fixPartialFilePath($shareKeyPath) . '.' . $userId . '.shareKey'; + $writePath = $basePath . '/' . \OCA\Encryption\Helper::fixPartialFilePath($shareKeyPath) . '.' . $userId . '.shareKey'; } else { $writePath = $basePath . '/' . $shareKeyPath . '.' . $userId . '.shareKey'; } @@ -422,7 +396,7 @@ class Keymanager { $util = new Util($view, \OCP\User::getUser()); list($owner, $filename) = $util->getUidAndFilename($filePath); - $filename = self::fixPartialFilePath($filename); + $filename = \OCA\Encryption\Helper::fixPartialFilePath($filename); // in case of system wide mount points the keys are stored directly in the data directory if ($util->isSystemWideMountPoint($filename)) { $shareKeyPath = '/files_encryption/share-keys/' . $filename . '.' . $userId . '.shareKey'; diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 53d58fbf40..9ae38a4ad8 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -1138,10 +1138,7 @@ class Util { // Make sure that a share key is generated for the owner too list($owner, $ownerPath) = $this->getUidAndFilename($filePath); - $pathinfo = pathinfo($ownerPath); - if(array_key_exists('extension', $pathinfo) && $pathinfo['extension'] === 'part') { - $ownerPath = $pathinfo['dirname'] . '/' . $pathinfo['filename']; - } + $ownerPath = \OCA\Encryption\Helper::fixPartialFilePath($ownerPath); $userIds = array(); if ($sharingEnabled) { From 9f10f15fd459234c160fb3e41eab623607e52e72 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 12 Nov 2013 10:24:10 +0100 Subject: [PATCH 5/7] fixing tests for the new part file handling --- apps/files_encryption/lib/helper.php | 16 ++++++ apps/files_encryption/lib/keymanager.php | 28 +++------- apps/files_encryption/lib/proxy.php | 6 +-- apps/files_encryption/tests/helper.php | 61 ++++++++++++++++++++++ apps/files_encryption/tests/keymanager.php | 17 ------ 5 files changed, 86 insertions(+), 42 deletions(-) create mode 100644 apps/files_encryption/tests/helper.php diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index 98a5f1f2f2..48175e460e 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -156,6 +156,22 @@ class Helper { return $return; } + /** + * @brief Check if a path is a .part file + * @param string $path Path that may identify a .part file + * @return bool + */ + public static function isPartialFilePath($path) { + + $extension = pathinfo($path, PATHINFO_EXTENSION); + if ( $extension === 'part' || $extension === 'etmp') { + return true; + } else { + return false; + } + + } + /** * @brief Remove .path extension from a file path diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php index 578d8965b4..794641f712 100755 --- a/apps/files_encryption/lib/keymanager.php +++ b/apps/files_encryption/lib/keymanager.php @@ -152,10 +152,10 @@ class Keymanager { } // try reusing key file if part file - if (self::isPartialFilePath($targetPath)) { + if (Helper::isPartialFilePath($targetPath)) { $result = $view->file_put_contents( - $basePath . '/' . \OCA\Encryption\Helper::fixPartialFilePath($targetPath) . '.key', $catfile); + $basePath . '/' . Helper::fixPartialFilePath($targetPath) . '.key', $catfile); } else { @@ -169,22 +169,6 @@ class Keymanager { } - /** - * @brief Check if a path is a .part file - * @param string $path Path that may identify a .part file - * @return bool - */ - public static function isPartialFilePath($path) { - - $extension = pathinfo($path, PATHINFO_EXTENSION); - if ( $extension === 'part' || $extension === 'etmp') { - return true; - } else { - return false; - } - - } - /** * @brief retrieve keyfile for an encrypted file * @param \OC_FilesystemView $view @@ -200,7 +184,7 @@ class Keymanager { $util = new Util($view, \OCP\User::getUser()); list($owner, $filename) = $util->getUidAndFilename($filePath); - $filename = \OCA\Encryption\Helper::fixPartialFilePath($filename); + $filename = Helper::fixPartialFilePath($filename); $filePath_f = ltrim($filename, '/'); // in case of system wide mount points the keys are stored directly in the data directory @@ -359,8 +343,8 @@ class Keymanager { foreach ($shareKeys as $userId => $shareKey) { // try reusing key file if part file - if (self::isPartialFilePath($shareKeyPath)) { - $writePath = $basePath . '/' . \OCA\Encryption\Helper::fixPartialFilePath($shareKeyPath) . '.' . $userId . '.shareKey'; + if (Helper::isPartialFilePath($shareKeyPath)) { + $writePath = $basePath . '/' . Helper::fixPartialFilePath($shareKeyPath) . '.' . $userId . '.shareKey'; } else { $writePath = $basePath . '/' . $shareKeyPath . '.' . $userId . '.shareKey'; } @@ -396,7 +380,7 @@ class Keymanager { $util = new Util($view, \OCP\User::getUser()); list($owner, $filename) = $util->getUidAndFilename($filePath); - $filename = \OCA\Encryption\Helper::fixPartialFilePath($filename); + $filename = Helper::fixPartialFilePath($filename); // in case of system wide mount points the keys are stored directly in the data directory if ($util->isSystemWideMountPoint($filename)) { $shareKeyPath = '/files_encryption/share-keys/' . $filename . '.' . $userId . '.shareKey'; diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 6dc5c9ce1b..e2bc8f6b16 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -342,7 +342,7 @@ class Proxy extends \OC_FileProxy { $fileInfo = false; // get file info from database/cache if not .part file - if (!Keymanager::isPartialFilePath($path)) { + if (!Helper::isPartialFilePath($path)) { $fileInfo = $view->getFileInfo($path); } @@ -353,7 +353,7 @@ class Proxy extends \OC_FileProxy { $fixSize = $util->getFileSize($path); $fileInfo['unencrypted_size'] = $fixSize; // put file info if not .part file - if (!Keymanager::isPartialFilePath($relativePath)) { + if (!Helper::isPartialFilePath($relativePath)) { $view->putFileInfo($path, $fileInfo); } } @@ -372,7 +372,7 @@ class Proxy extends \OC_FileProxy { $fileInfo['unencrypted_size'] = $size; // put file info if not .part file - if (!Keymanager::isPartialFilePath($relativePath)) { + if (!Helper::isPartialFilePath($relativePath)) { $view->putFileInfo($path, $fileInfo); } } diff --git a/apps/files_encryption/tests/helper.php b/apps/files_encryption/tests/helper.php new file mode 100644 index 0000000000..cccf9c7522 --- /dev/null +++ b/apps/files_encryption/tests/helper.php @@ -0,0 +1,61 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +require_once __DIR__ . '/../../../lib/base.php'; +require_once __DIR__ . '/../lib/crypt.php'; +require_once __DIR__ . '/../lib/keymanager.php'; +require_once __DIR__ . '/../lib/proxy.php'; +require_once __DIR__ . '/../lib/stream.php'; +require_once __DIR__ . '/../lib/util.php'; +require_once __DIR__ . '/../lib/helper.php'; +require_once __DIR__ . '/../appinfo/app.php'; +require_once __DIR__ . '/util.php'; + +use OCA\Encryption; + +/** + * Class Test_Encryption_Keymanager + */ +class Test_Encryption_Helper extends \PHPUnit_Framework_TestCase { + + /** + * @medium + */ + function testFixPartialFilePath() { + + $partFilename = 'testfile.txt.part'; + $filename = 'testfile.txt'; + + $this->assertTrue(Encryption\Keymanager::isPartialFilePath($partFilename)); + + $this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($partFilename)); + + $this->assertFalse(Encryption\Keymanager::isPartialFilePath($filename)); + + $this->assertEquals('testfile.txt', Encryption\Keymanager::fixPartialFilePath($filename)); + } + + + /** + * @medium + */ + function testFixPartialFileWithTransferIdPath() { + + $partFilename = 'testfile.txt.ocTransferId643653835.part'; + $filename = 'testfile.txt'; + + $this->assertTrue(Encryption\Helper::isPartialFilePath($partFilename)); + + $this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($partFilename)); + + $this->assertFalse(Encryption\Helper::isPartialFilePath($filename)); + + $this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($filename)); + } + +} \ No newline at end of file diff --git a/apps/files_encryption/tests/keymanager.php b/apps/files_encryption/tests/keymanager.php index b2d200cca3..ad6bbd3a7e 100644 --- a/apps/files_encryption/tests/keymanager.php +++ b/apps/files_encryption/tests/keymanager.php @@ -188,23 +188,6 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase { $this->assertArrayHasKey('key', $sslInfoPrivate); } - /** - * @medium - */ - function testFixPartialFilePath() { - - $partFilename = 'testfile.txt.part'; - $filename = 'testfile.txt'; - - $this->assertTrue(Encryption\Keymanager::isPartialFilePath($partFilename)); - - $this->assertEquals('testfile.txt', Encryption\Keymanager::fixPartialFilePath($partFilename)); - - $this->assertFalse(Encryption\Keymanager::isPartialFilePath($filename)); - - $this->assertEquals('testfile.txt', Encryption\Keymanager::fixPartialFilePath($filename)); - } - /** * @medium */ From fcbb5d6cb328a755a637be8725c161f0dfb685a6 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 12 Nov 2013 11:17:34 +0100 Subject: [PATCH 6/7] missed some replacements... now tests should work --- apps/files_encryption/tests/helper.php | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/apps/files_encryption/tests/helper.php b/apps/files_encryption/tests/helper.php index cccf9c7522..45ef5e9ac4 100644 --- a/apps/files_encryption/tests/helper.php +++ b/apps/files_encryption/tests/helper.php @@ -1,25 +1,18 @@ + * Copyright (c) 2013 Bjoern Schiessle * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ -require_once __DIR__ . '/../../../lib/base.php'; -require_once __DIR__ . '/../lib/crypt.php'; -require_once __DIR__ . '/../lib/keymanager.php'; -require_once __DIR__ . '/../lib/proxy.php'; -require_once __DIR__ . '/../lib/stream.php'; -require_once __DIR__ . '/../lib/util.php'; + require_once __DIR__ . '/../lib/helper.php'; -require_once __DIR__ . '/../appinfo/app.php'; -require_once __DIR__ . '/util.php'; use OCA\Encryption; /** - * Class Test_Encryption_Keymanager + * Class Test_Encryption_Helper */ class Test_Encryption_Helper extends \PHPUnit_Framework_TestCase { @@ -31,13 +24,13 @@ class Test_Encryption_Helper extends \PHPUnit_Framework_TestCase { $partFilename = 'testfile.txt.part'; $filename = 'testfile.txt'; - $this->assertTrue(Encryption\Keymanager::isPartialFilePath($partFilename)); + $this->assertTrue(Encryption\Helper::isPartialFilePath($partFilename)); $this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($partFilename)); - $this->assertFalse(Encryption\Keymanager::isPartialFilePath($filename)); + $this->assertFalse(Encryption\Helper::isPartialFilePath($filename)); - $this->assertEquals('testfile.txt', Encryption\Keymanager::fixPartialFilePath($filename)); + $this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($filename)); } From 77429c28fd6a363959a1c4cf034a956059849d6b Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 12 Nov 2013 16:48:24 +0100 Subject: [PATCH 7/7] rename fixPartialFilePath() to stripPartialFileExtension(), this name describes better what the method actually does --- apps/files_encryption/lib/helper.php | 2 +- apps/files_encryption/lib/keymanager.php | 8 ++++---- apps/files_encryption/lib/util.php | 2 +- apps/files_encryption/tests/helper.php | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index 48175e460e..54098c13b2 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -179,7 +179,7 @@ class Helper { * @return string File path without .part extension * @note this is needed for reusing keys */ - public static function fixPartialFilePath($path) { + public static function stripPartialFileExtension($path) { $extension = pathinfo($path, PATHINFO_EXTENSION); if ( $extension === 'part' || $extension === 'etmp') { diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php index 794641f712..6dadd12a62 100755 --- a/apps/files_encryption/lib/keymanager.php +++ b/apps/files_encryption/lib/keymanager.php @@ -155,7 +155,7 @@ class Keymanager { if (Helper::isPartialFilePath($targetPath)) { $result = $view->file_put_contents( - $basePath . '/' . Helper::fixPartialFilePath($targetPath) . '.key', $catfile); + $basePath . '/' . Helper::stripPartialFileExtension($targetPath) . '.key', $catfile); } else { @@ -184,7 +184,7 @@ class Keymanager { $util = new Util($view, \OCP\User::getUser()); list($owner, $filename) = $util->getUidAndFilename($filePath); - $filename = Helper::fixPartialFilePath($filename); + $filename = Helper::stripPartialFileExtension($filename); $filePath_f = ltrim($filename, '/'); // in case of system wide mount points the keys are stored directly in the data directory @@ -344,7 +344,7 @@ class Keymanager { // try reusing key file if part file if (Helper::isPartialFilePath($shareKeyPath)) { - $writePath = $basePath . '/' . Helper::fixPartialFilePath($shareKeyPath) . '.' . $userId . '.shareKey'; + $writePath = $basePath . '/' . Helper::stripPartialFileExtension($shareKeyPath) . '.' . $userId . '.shareKey'; } else { $writePath = $basePath . '/' . $shareKeyPath . '.' . $userId . '.shareKey'; } @@ -380,7 +380,7 @@ class Keymanager { $util = new Util($view, \OCP\User::getUser()); list($owner, $filename) = $util->getUidAndFilename($filePath); - $filename = Helper::fixPartialFilePath($filename); + $filename = Helper::stripPartialFileExtension($filename); // in case of system wide mount points the keys are stored directly in the data directory if ($util->isSystemWideMountPoint($filename)) { $shareKeyPath = '/files_encryption/share-keys/' . $filename . '.' . $userId . '.shareKey'; diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 9ae38a4ad8..835962536d 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -1138,7 +1138,7 @@ class Util { // Make sure that a share key is generated for the owner too list($owner, $ownerPath) = $this->getUidAndFilename($filePath); - $ownerPath = \OCA\Encryption\Helper::fixPartialFilePath($ownerPath); + $ownerPath = \OCA\Encryption\Helper::stripPartialFileExtension($ownerPath); $userIds = array(); if ($sharingEnabled) { diff --git a/apps/files_encryption/tests/helper.php b/apps/files_encryption/tests/helper.php index 45ef5e9ac4..067fc763a9 100644 --- a/apps/files_encryption/tests/helper.php +++ b/apps/files_encryption/tests/helper.php @@ -19,36 +19,36 @@ class Test_Encryption_Helper extends \PHPUnit_Framework_TestCase { /** * @medium */ - function testFixPartialFilePath() { + function testStripPartialFileExtension() { $partFilename = 'testfile.txt.part'; $filename = 'testfile.txt'; $this->assertTrue(Encryption\Helper::isPartialFilePath($partFilename)); - $this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($partFilename)); + $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($partFilename)); $this->assertFalse(Encryption\Helper::isPartialFilePath($filename)); - $this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($filename)); + $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($filename)); } /** * @medium */ - function testFixPartialFileWithTransferIdPath() { + function testStripPartialFileExtensionWithTransferIdPath() { $partFilename = 'testfile.txt.ocTransferId643653835.part'; $filename = 'testfile.txt'; $this->assertTrue(Encryption\Helper::isPartialFilePath($partFilename)); - $this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($partFilename)); + $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($partFilename)); $this->assertFalse(Encryption\Helper::isPartialFilePath($filename)); - $this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($filename)); + $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($filename)); } } \ No newline at end of file