Skip to content

Commit 56a734b

Browse files
authored
Merge pull request nextcloud#48364 from nextcloud/backport/48345/stable29
[stable29] fix(files_external): Catch correct exception
2 parents 8446a1e + 50eecc7 commit 56a734b

File tree

1 file changed

+9
-7
lines changed
  • apps/files_external/lib/Lib/Storage

1 file changed

+9
-7
lines changed

apps/files_external/lib/Lib/Storage/SMB.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ protected function relativePath($fullPath) {
190190
* @param string $path
191191
* @return IFileInfo
192192
* @throws StorageAuthException
193+
* @throws \OCP\Files\NotFoundException
194+
* @throws \OCP\Files\ForbiddenException
193195
*/
194196
protected function getFileInfo($path) {
195197
try {
@@ -366,7 +368,7 @@ public function rename($source, $target, $retry = true): bool {
366368
public function stat($path, $retry = true) {
367369
try {
368370
$result = $this->formatInfo($this->getFileInfo($path));
369-
} catch (ForbiddenException $e) {
371+
} catch (\OCP\Files\ForbiddenException $e) {
370372
return false;
371373
} catch (\OCP\Files\NotFoundException $e) {
372374
return false;
@@ -587,7 +589,7 @@ public function getMetaData($path) {
587589
$fileInfo = $this->getFileInfo($path);
588590
} catch (\OCP\Files\NotFoundException $e) {
589591
return null;
590-
} catch (ForbiddenException $e) {
592+
} catch (\OCP\Files\ForbiddenException $e) {
591593
return null;
592594
}
593595
if (!$fileInfo) {
@@ -663,7 +665,7 @@ public function filetype($path) {
663665
return $this->getFileInfo($path)->isDirectory() ? 'dir' : 'file';
664666
} catch (\OCP\Files\NotFoundException $e) {
665667
return false;
666-
} catch (ForbiddenException $e) {
668+
} catch (\OCP\Files\ForbiddenException $e) {
667669
return false;
668670
}
669671
}
@@ -698,7 +700,7 @@ public function file_exists($path) {
698700
return true;
699701
} catch (\OCP\Files\NotFoundException $e) {
700702
return false;
701-
} catch (ForbiddenException $e) {
703+
} catch (\OCP\Files\ForbiddenException $e) {
702704
return false;
703705
} catch (ConnectException $e) {
704706
throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e);
@@ -711,7 +713,7 @@ public function isReadable($path) {
711713
return $this->showHidden || !$info->isHidden();
712714
} catch (\OCP\Files\NotFoundException $e) {
713715
return false;
714-
} catch (ForbiddenException $e) {
716+
} catch (\OCP\Files\ForbiddenException $e) {
715717
return false;
716718
}
717719
}
@@ -724,7 +726,7 @@ public function isUpdatable($path) {
724726
return ($this->showHidden || !$info->isHidden()) && (!$info->isReadOnly() || $info->isDirectory());
725727
} catch (\OCP\Files\NotFoundException $e) {
726728
return false;
727-
} catch (ForbiddenException $e) {
729+
} catch (\OCP\Files\ForbiddenException $e) {
728730
return false;
729731
}
730732
}
@@ -735,7 +737,7 @@ public function isDeletable($path) {
735737
return ($this->showHidden || !$info->isHidden()) && !$info->isReadOnly();
736738
} catch (\OCP\Files\NotFoundException $e) {
737739
return false;
738-
} catch (ForbiddenException $e) {
740+
} catch (\OCP\Files\ForbiddenException $e) {
739741
return false;
740742
}
741743
}

0 commit comments

Comments
 (0)