summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/cache.php
diff options
context:
space:
mode:
authoricewind1991 <robin@icewind.nl>2014-04-25 15:54:36 +0200
committericewind1991 <robin@icewind.nl>2014-04-25 15:54:36 +0200
commit7599fa94ceffe9579b1312be45e1b5b5041151a9 (patch)
treea11fdf1f78d2166cb984e2299aa447257e70b47a /apps/files_sharing/lib/cache.php
parent5194f014c9c196bb891b6ed057500bd151ee7169 (diff)
parent194ea66cb51186be46a090c0ee915dcaf068fe94 (diff)
downloadnextcloud-server-7599fa94ceffe9579b1312be45e1b5b5041151a9.tar.gz
nextcloud-server-7599fa94ceffe9579b1312be45e1b5b5041151a9.zip
Merge pull request #8350 from owncloud/share-search-mime
fix search by mime for shared single files
Diffstat (limited to 'apps/files_sharing/lib/cache.php')
-rw-r--r--apps/files_sharing/lib/cache.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 67a0410ef76..8c680e9c977 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -86,14 +86,13 @@ class Shared_Cache extends Cache {
public function get($file) {
if (is_string($file)) {
if ($cache = $this->getSourceCache($file)) {
- $path = 'files' . $this->storage->getMountPoint();
- $path .= ($file !== '') ? '/' . $file : '';
$data = $cache->get($this->files[$file]);
$data['displayname_owner'] = \OC_User::getDisplayName($this->storage->getSharedFrom());
- $data['path'] = $path;
+ $data['path'] = $file;
if ($file === '') {
$data['is_share_mount_point'] = true;
}
+ $data['uid_owner'] = $this->storage->getOwner($file);
return $data;
}
} else {
@@ -101,7 +100,6 @@ class Shared_Cache extends Cache {
// cache information for the source item
if (!is_int($file) || $file === 0) {
$file = $this->storage->getSourceId();
- $mountPoint = $this->storage->getMountPoint();
}
$query = \OC_DB::prepare(
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,'
@@ -124,8 +122,8 @@ class Shared_Cache extends Cache {
} else {
$data['size'] = (int)$data['size'];
}
- if (isset($mountPoint)) {
- $data['path'] = 'files/' . $mountPoint;
+ if (!is_int($file) || $file === 0) {
+ $data['path'] = '';
$data['is_share_mount_point'] = true;
}
return $data;
@@ -299,6 +297,11 @@ class Shared_Cache extends Cache {
$files = $this->getFolderContents($dir);
// no results?
if (!$files) {
+ // maybe it's a single shared file
+ $file = $this->get('');
+ if (($mimepart && $file['mimepart'] === $mimepart) || ($mimetype && $file['mimetype'] === $mimetype)) {
+ $result[] = $file;
+ }
continue;
}
foreach ($files as $file) {