[Pkg-owncloud-commits] [owncloud] 96/172: Fixed getAbsolutePath	case when path is "0"
    David Prévot 
    taffit at moszumanska.debian.org
       
    Sun May 18 20:09:44 UTC 2014
    
    
  
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit bab8c1f8e51a93443c29fdabfdc9951d0efde473
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Tue May 13 14:17:51 2014 +0200
    Fixed getAbsolutePath case when path is "0"
    
    Make sure to correctly check for string emptiness when the passed path
    is "0".
---
 lib/private/files/view.php |  2 +-
 tests/lib/files/view.php   | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 407f598..39c71cf 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -37,7 +37,7 @@ class View {
 	}
 
 	public function getAbsolutePath($path = '/') {
-		if (!$path) {
+		if ($path === '') {
 			$path = '/';
 		}
 		if ($path[0] !== '/') {
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index f80dd06..a51b158 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -585,4 +585,22 @@ class View extends \PHPUnit_Framework_TestCase {
 		$info2 = $view->getFileInfo('/test/test');
 		$this->assertSame($info['etag'], $info2['etag']);
 	}
+
+	/**
+	 * @dataProvider absolutePathProvider
+	 */
+	public function testGetAbsolutePath($expectedPath, $relativePath) {
+		$view = new \OC\Files\View('/files');
+		$this->assertEquals($expectedPath, $view->getAbsolutePath($relativePath));
+	}
+
+	function absolutePathProvider() {
+		return array(
+			array('/files/', ''),
+			array('/files/0', '0'),
+			array('/files/', '/'),
+			array('/files/test', 'test'),
+			array('/files/test', '/test'),
+		);
+	}
 }
-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
    
    
More information about the Pkg-owncloud-commits
mailing list