summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-03-07 11:12:59 -0500
committerMichael Gapczynski <mtgap@owncloud.com>2013-03-07 11:12:59 -0500
commita5cab28bea6188ce840d7d115064c4780531e13d (patch)
tree6dd8b77c35c6a2082616d9427f573441ab63e5e4 /lib
parente5a497c9248fcab82b84befbc3842affccc71f9d (diff)
downloadnextcloud-server-a5cab28bea6188ce840d7d115064c4780531e13d.tar.gz
nextcloud-server-a5cab28bea6188ce840d7d115064c4780531e13d.zip
Fix fetching source path of shared files
Diffstat (limited to 'lib')
-rw-r--r--lib/files/mount.php26
-rw-r--r--lib/files/view.php2
-rw-r--r--lib/public/share.php2
3 files changed, 26 insertions, 4 deletions
diff --git a/lib/files/mount.php b/lib/files/mount.php
index 6e99d8eabb4..1c9382d78e7 100644
--- a/lib/files/mount.php
+++ b/lib/files/mount.php
@@ -176,10 +176,12 @@ class Mount {
}
/**
+ * Find mounts by storage id
+ *
* @param string $id
- * @return \OC\Files\Storage\Storage[]
+ * @return Mount[]
*/
- public static function findById($id) {
+ public static function findByStorageId($id) {
if (strlen($id) > 64) {
$id = md5($id);
}
@@ -191,4 +193,24 @@ class Mount {
}
return $result;
}
+
+ /**
+ * Find mounts by numeric storage id
+ *
+ * @param string $id
+ * @return Mount
+ */
+ public static function findByNumericId($id) {
+ $query = \OC_DB::prepare('SELECT `id` FROM `*PREFIX*storages` WHERE `numeric_id` = ?');
+ $result = $query->execute(array($id))->fetchOne();
+ if ($result) {
+ $id = $result;
+ foreach (self::$mounts as $mount) {
+ if ($mount->getStorageId() === $id) {
+ return $mount;
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/lib/files/view.php b/lib/files/view.php
index 3e2cb080e1d..4ed3234552e 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -960,7 +960,7 @@ class View {
*/
public function getPath($id) {
list($storage, $internalPath) = Cache\Cache::getById($id);
- $mounts = Mount::findById($storage);
+ $mounts = Mount::findByStorageId($storage);
foreach ($mounts as $mount) {
/**
* @var \OC\Files\Mount $mount
diff --git a/lib/public/share.php b/lib/public/share.php
index 8146a23f360..59f41a9bfd6 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -786,7 +786,7 @@ class Share {
} else {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,
`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,
- `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`, `token`';
+ `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`, `token`, `storage`';
}
} else {
$select = '*';