summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index 070d69d05ae..9ee7ef0516b 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -516,6 +516,14 @@ class Share {
// If the limit is not 1, the filtering can be done later
$where .= ' ORDER BY `*PREFIX*share`.`id` DESC';
}
+ // The limit must be at least 3, because filtering needs to be done
+ if ($limit < 3) {
+ $queryLimit = 3;
+ } else {
+ $queryLimit = $limit;
+ }
+ } else {
+ $queryLimit = null;
}
// TODO Optimize selects
if ($format == self::FORMAT_STATUSES) {
@@ -544,8 +552,7 @@ class Share {
}
}
$root = strlen($root);
- // The limit must be at least 3, because filtering needs to be done
- $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$where, ($limit < 3 ? 3 : $limit));
+ $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$where, $queryLimit);
$result = $query->execute($queryArgs);
$items = array();
$targets = array();