From 77429c28fd6a363959a1c4cf034a956059849d6b Mon Sep 17 00:00:00 2001
From: Bjoern Schiessle <schiessle@owncloud.com>
Date: Tue, 12 Nov 2013 16:48:24 +0100
Subject: [PATCH] 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
-- 
GitLab