Skip to content

Commit e8b2d1d

Browse files
authored
Merge branch 'master' into excludedisabled
2 parents 25dc298 + 197db6a commit e8b2d1d

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

apps/dav/lib/Upload/UploadHome.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use OCP\Files\NotFoundException;
1515
use OCP\IUserSession;
1616
use Sabre\DAV\Exception\Forbidden;
17+
use Sabre\DAV\Exception\NotFound;
1718
use Sabre\DAV\ICollection;
1819

1920
class UploadHome implements ICollection {
@@ -72,7 +73,12 @@ public function getChildren(): array {
7273
}
7374

7475
public function childExists($name): bool {
75-
return !is_null($this->getChild($name));
76+
try {
77+
$this->getChild($name);
78+
return true;
79+
} catch (NotFound $e) {
80+
return false;
81+
}
7682
}
7783

7884
public function delete() {

build/integration/features/bootstrap/BasicStructure.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,13 @@ public function sleepForSeconds($seconds) {
475475
sleep((int)$seconds);
476476
}
477477

478+
/**
479+
* @BeforeSuite
480+
*/
481+
public static function createPHPUnitConfiguration(): void {
482+
(new \PHPUnit\TextUI\Configuration\Builder())->build([]);
483+
}
484+
478485
/**
479486
* @BeforeSuite
480487
*/

lib/private/Share20/Manager.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,16 +1265,16 @@ public function getSharesBy($userId, $shareType, $path = null, $reshares = false
12651265
while (true) {
12661266
$added = 0;
12671267
foreach ($shares as $share) {
1268+
$added++;
12681269
if ($onlyValid) {
12691270
try {
1270-
$this->checkShare($share);
1271+
$this->checkShare($share, $added);
12711272
} catch (ShareNotFound $e) {
12721273
// Ignore since this basically means the share is deleted
12731274
continue;
12741275
}
12751276
}
12761277

1277-
$added++;
12781278
$shares2[] = $share;
12791279

12801280
if (count($shares2) === $limit) {
@@ -1480,11 +1480,14 @@ public function getShareByToken($token) {
14801480
/**
14811481
* Check expire date and disabled owner
14821482
*
1483+
* @param int &$added If given, will be decremented if the share is deleted
14831484
* @throws ShareNotFound
14841485
*/
1485-
protected function checkShare(IShare $share): void {
1486+
private function checkShare(IShare $share, int &$added = 1): void {
14861487
if ($share->isExpired()) {
14871488
$this->deleteShare($share);
1489+
// Remove 1 to added, because this share was deleted
1490+
$added--;
14881491
throw new ShareNotFound($this->l->t('The requested share does not exist anymore'));
14891492
}
14901493
if ($this->config->getAppValue('files_sharing', 'hide_disabled_user_shares', 'no') === 'yes') {

0 commit comments

Comments
 (0)