use absolute paths when resolving mount points
This commit is contained in:
parent
3437071cf1
commit
5bfff6c56e
|
@ -249,13 +249,3 @@ class OC_Files {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function fileCmp($a, $b) {
|
||||
if ($a['type'] == 'dir' and $b['type'] != 'dir') {
|
||||
return -1;
|
||||
} elseif ($a['type'] != 'dir' and $b['type'] == 'dir') {
|
||||
return 1;
|
||||
} else {
|
||||
return strnatcasecmp($a['name'], $b['name']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,9 @@ class Permissions {
|
|||
* @return int[]
|
||||
*/
|
||||
static public function getMultiple($fileIds, $user) {
|
||||
if (count($fileIds) === 0) {
|
||||
return array();
|
||||
}
|
||||
$params = $fileIds;
|
||||
$params[] = $user;
|
||||
$inPart = implode(', ', array_fill(0, count($fileIds), '?'));
|
||||
|
|
|
@ -110,6 +110,7 @@ class View {
|
|||
*/
|
||||
public function getLocalFile($path) {
|
||||
$parent = substr($path, 0, strrpos($path, '/'));
|
||||
$path = $this->getAbsolutePath($path);
|
||||
list($storage, $internalPath) = Filesystem::resolvePath($path);
|
||||
if (Filesystem::isValidPath($parent) and $storage) {
|
||||
return $storage->getLocalFile($internalPath);
|
||||
|
@ -124,6 +125,7 @@ class View {
|
|||
*/
|
||||
public function getLocalFolder($path) {
|
||||
$parent = substr($path, 0, strrpos($path, '/'));
|
||||
$path = $this->getAbsolutePath($path);
|
||||
list($storage, $internalPath) = Filesystem::resolvePath($path);
|
||||
if (Filesystem::isValidPath($parent) and $storage) {
|
||||
return $storage->getLocalFolder($internalPath);
|
||||
|
@ -334,8 +336,8 @@ class View {
|
|||
$mp1 = $this->getMountPoint($path1 . $postFix1);
|
||||
$mp2 = $this->getMountPoint($path2 . $postFix2);
|
||||
if ($mp1 == $mp2) {
|
||||
list($storage, $internalPath1) = Filesystem::resolvePath($path1 . $postFix1);
|
||||
list(, $internalPath2) = Filesystem::resolvePath($path2 . $postFix2);
|
||||
list($storage, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
|
||||
list(, $internalPath2) = Filesystem::resolvePath($absolutePath2 . $postFix2);
|
||||
if ($storage) {
|
||||
$result = $storage->rename($internalPath1, $internalPath2);
|
||||
} else {
|
||||
|
@ -345,7 +347,7 @@ class View {
|
|||
$source = $this->fopen($path1 . $postFix1, 'r');
|
||||
$target = $this->fopen($path2 . $postFix2, 'w');
|
||||
$count = \OC_Helper::streamCopy($source, $target);
|
||||
list($storage1, $internalPath1) = Filesystem::resolvePath($path1 . $postFix1);
|
||||
list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
|
||||
$storage1->unlink($internalPath1);
|
||||
$result = $count > 0;
|
||||
}
|
||||
|
@ -417,8 +419,8 @@ class View {
|
|||
$mp1 = $this->getMountPoint($path1 . $postFix1);
|
||||
$mp2 = $this->getMountPoint($path2 . $postFix2);
|
||||
if ($mp1 == $mp2) {
|
||||
list($storage, $internalPath1) = Filesystem::resolvePath($path1 . $postFix1);
|
||||
list(, $internalPath2) = Filesystem::resolvePath($path2 . $postFix2);
|
||||
list($storage, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
|
||||
list(, $internalPath2) = Filesystem::resolvePath($absolutePath2 . $postFix2);
|
||||
if ($storage) {
|
||||
$result = $storage->copy($internalPath1, $internalPath2);
|
||||
} else {
|
||||
|
@ -552,7 +554,7 @@ class View {
|
|||
array(Filesystem::signal_param_path => $path)
|
||||
);
|
||||
}
|
||||
list($storage, $internalPath) = Filesystem::resolvePath($path . $postFix);
|
||||
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
|
||||
if ($storage) {
|
||||
$result = $storage->hash($type, $internalPath, $raw);
|
||||
$result = \OC_FileProxy::runPostProxies('hash', $absolutePath, $result);
|
||||
|
@ -587,7 +589,7 @@ class View {
|
|||
return false;
|
||||
}
|
||||
$run = $this->runHooks($hooks, $path);
|
||||
list($storage, $internalPath) = Filesystem::resolvePath($path . $postFix);
|
||||
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
|
||||
if ($run and $storage) {
|
||||
if (!is_null($extraParam)) {
|
||||
$result = $storage->$operation($internalPath, $extraParam);
|
||||
|
@ -747,8 +749,23 @@ class View {
|
|||
$files[$i]['permissions'] = $permissions[$file['fileid']];
|
||||
}
|
||||
|
||||
usort($files, "fileCmp");
|
||||
return $files;
|
||||
if ($mimetype_filter) {
|
||||
foreach ($files as $file) {
|
||||
if (strpos($mimetype_filter, '/')) {
|
||||
if ($file['mimetype'] === $mimetype_filter) {
|
||||
$result[] = $file;
|
||||
}
|
||||
} else {
|
||||
if ($file['mimepart'] === $mimetype_filter) {
|
||||
$result[] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$result = $files;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -534,7 +534,7 @@ class Share {
|
|||
$backend = self::getBackend($itemType);
|
||||
// Get filesystem root to add it to the file target and remove from the file source, match file_source with the file cache
|
||||
if ($itemType == 'file' || $itemType == 'folder') {
|
||||
$root = \OC_Filesystem::getRoot();
|
||||
$root = \OC\Files\Filesystem::getRoot();
|
||||
$where = 'INNER JOIN `*PREFIX*fscache` ON `file_source` = `*PREFIX*fscache`.`id`';
|
||||
if (!isset($item)) {
|
||||
$where .= ' WHERE `file_target` IS NOT NULL';
|
||||
|
@ -621,7 +621,7 @@ class Share {
|
|||
} else {
|
||||
if ($itemType == 'file' || $itemType == 'folder') {
|
||||
$where .= ' `file_target` = ?';
|
||||
$item = \OC_Filesystem::normalizePath($item);
|
||||
$item = \OC\Files\Filesystem::normalizePath($item);
|
||||
} else {
|
||||
$where .= ' `item_target` = ?';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue