fix some edge cases while scanning the root of a storage
This commit is contained in:
parent
72b6faa69d
commit
01eb5d2790
2 changed files with 4 additions and 4 deletions
4
lib/files/cache/scanner.php
vendored
4
lib/files/cache/scanner.php
vendored
|
@ -71,7 +71,7 @@ class Scanner {
|
|||
\OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId));
|
||||
$data = $this->getData($file);
|
||||
if ($data) {
|
||||
if ($file !== '') {
|
||||
if ($file) {
|
||||
$parent = dirname($file);
|
||||
if ($parent === '.') {
|
||||
$parent = '';
|
||||
|
@ -101,7 +101,7 @@ class Scanner {
|
|||
if ($dh = $this->storage->opendir($path)) {
|
||||
while ($file = readdir($dh)) {
|
||||
if ($file !== '.' and $file !== '..') {
|
||||
$child = ($path !== '') ? $path . '/' . $file : $file;
|
||||
$child = ($path) ? $path . '/' . $file : $file;
|
||||
$data = $this->scanFile($child);
|
||||
if ($data) {
|
||||
if ($data['mimetype'] === 'httpd/unix-directory') {
|
||||
|
|
|
@ -143,8 +143,8 @@ class Filesystem {
|
|||
* @return string
|
||||
*/
|
||||
static public function getMountPoint($path) {
|
||||
\OC_Hook::emit(self::CLASSNAME, 'get_mountpoint', array('path' => $path));
|
||||
$path = self::normalizePath($path) . '/';
|
||||
\OC_Hook::emit(self::CLASSNAME, 'get_mountpoint', array('path' => $path));
|
||||
$foundMountPoint = '';
|
||||
$mountPoints = array_keys(self::$mounts);
|
||||
foreach ($mountPoints as $mountpoint) {
|
||||
|
@ -205,7 +205,7 @@ class Filesystem {
|
|||
$mountpoint = self::getMountPoint($path);
|
||||
if ($mountpoint) {
|
||||
$storage = self::getStorage($mountpoint);
|
||||
if ($mountpoint === $path) {
|
||||
if ($mountpoint === $path or $mountpoint . '/' === $path) {
|
||||
$internalPath = '';
|
||||
} else {
|
||||
$internalPath = substr($path, strlen($mountpoint));
|
||||
|
|
Loading…
Reference in a new issue