Browse Source

Merge pull request #8572 from owncloud/core-getabsolutepathwithzero

Fixed getAbsolutePath case when path is "0"
tags/v7.0.0alpha2
Thomas Müller 10 years ago
parent
commit
f5bc680f9c
2 changed files with 19 additions and 1 deletions
  1. 1
    1
      lib/private/files/view.php
  2. 18
    0
      tests/lib/files/view.php

+ 1
- 1
lib/private/files/view.php View File

} }


public function getAbsolutePath($path = '/') { public function getAbsolutePath($path = '/') {
if (!$path) {
if ($path === '') {
$path = '/'; $path = '/';
} }
if ($path[0] !== '/') { if ($path[0] !== '/') {

+ 18
- 0
tests/lib/files/view.php View File

$info2 = $view->getFileInfo('/test/test'); $info2 = $view->getFileInfo('/test/test');
$this->assertSame($info['etag'], $info2['etag']); $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'),
);
}
} }

Loading…
Cancel
Save