aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2024-09-25 09:07:33 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-09-26 07:34:36 +0000
commite98196b6c3ed7b223e1b232ffbfa91a1202db026 (patch)
tree3d3de70bbb29cbfdb7ab10991c411b052ded3c12
parentfa6f516c3c20abb68a91532af7b8c18dbfbb5aa9 (diff)
downloadnextcloud-server-backport/48345/stable28.tar.gz
nextcloud-server-backport/48345/stable28.zip
fix(files_external): Catch correct exceptionbackport/48345/stable28
SMB#getFileInfo used to throw an icewind/smb exception, but nowadays throws \OCP\Files\ForbiddenException. This fixes downstream methods to catch the new exception. Signed-off-by: Marcel Klehr <mklehr@gmx.net>
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index c7324db01e4..9330628d5ca 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -190,6 +190,8 @@ class SMB extends Common implements INotifyStorage {
* @param string $path
* @return IFileInfo
* @throws StorageAuthException
+ * @throws \OCP\Files\NotFoundException
+ * @throws \OCP\Files\ForbiddenException
*/
protected function getFileInfo($path) {
try {
@@ -366,7 +368,7 @@ class SMB extends Common implements INotifyStorage {
public function stat($path, $retry = true) {
try {
$result = $this->formatInfo($this->getFileInfo($path));
- } catch (ForbiddenException $e) {
+ } catch (\OCP\Files\ForbiddenException $e) {
return false;
} catch (\OCP\Files\NotFoundException $e) {
return false;
@@ -587,7 +589,7 @@ class SMB extends Common implements INotifyStorage {
$fileInfo = $this->getFileInfo($path);
} catch (\OCP\Files\NotFoundException $e) {
return null;
- } catch (ForbiddenException $e) {
+ } catch (\OCP\Files\ForbiddenException $e) {
return null;
}
if (!$fileInfo) {
@@ -663,7 +665,7 @@ class SMB extends Common implements INotifyStorage {
return $this->getFileInfo($path)->isDirectory() ? 'dir' : 'file';
} catch (\OCP\Files\NotFoundException $e) {
return false;
- } catch (ForbiddenException $e) {
+ } catch (\OCP\Files\ForbiddenException $e) {
return false;
}
}
@@ -698,7 +700,7 @@ class SMB extends Common implements INotifyStorage {
return true;
} catch (\OCP\Files\NotFoundException $e) {
return false;
- } catch (ForbiddenException $e) {
+ } catch (\OCP\Files\ForbiddenException $e) {
return false;
} catch (ConnectException $e) {
throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e);
@@ -711,7 +713,7 @@ class SMB extends Common implements INotifyStorage {
return $this->showHidden || !$info->isHidden();
} catch (\OCP\Files\NotFoundException $e) {
return false;
- } catch (ForbiddenException $e) {
+ } catch (\OCP\Files\ForbiddenException $e) {
return false;
}
}
@@ -724,7 +726,7 @@ class SMB extends Common implements INotifyStorage {
return ($this->showHidden || !$info->isHidden()) && (!$info->isReadOnly() || $info->isDirectory());
} catch (\OCP\Files\NotFoundException $e) {
return false;
- } catch (ForbiddenException $e) {
+ } catch (\OCP\Files\ForbiddenException $e) {
return false;
}
}
@@ -735,7 +737,7 @@ class SMB extends Common implements INotifyStorage {
return ($this->showHidden || !$info->isHidden()) && !$info->isReadOnly();
} catch (\OCP\Files\NotFoundException $e) {
return false;
- } catch (ForbiddenException $e) {
+ } catch (\OCP\Files\ForbiddenException $e) {
return false;
}
}