Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(files_external): Catch correct exception #48345

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions apps/files_external/lib/Lib/Storage/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ protected function relativePath($fullPath) {
* @param string $path
* @return IFileInfo
* @throws StorageAuthException
* @throws \OCP\Files\NotFoundException
* @throws \OCP\Files\ForbiddenException
*/
protected function getFileInfo($path) {
try {
Expand Down Expand Up @@ -336,7 +338,7 @@ public function rename($source, $target, $retry = true): bool {
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;
Expand Down Expand Up @@ -557,7 +559,7 @@ public function getMetaData($path) {
$fileInfo = $this->getFileInfo($path);
} catch (\OCP\Files\NotFoundException $e) {
return null;
} catch (ForbiddenException $e) {
} catch (\OCP\Files\ForbiddenException $e) {
return null;
}
if (!$fileInfo) {
Expand Down Expand Up @@ -633,7 +635,7 @@ public function filetype($path) {
return $this->getFileInfo($path)->isDirectory() ? 'dir' : 'file';
} catch (\OCP\Files\NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
} catch (\OCP\Files\ForbiddenException $e) {
return false;
}
}
Expand Down Expand Up @@ -668,7 +670,7 @@ public function file_exists($path) {
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);
Expand All @@ -681,7 +683,7 @@ public function isReadable($path) {
return $this->showHidden || !$info->isHidden();
} catch (\OCP\Files\NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
} catch (\OCP\Files\ForbiddenException $e) {
return false;
}
}
Expand All @@ -694,7 +696,7 @@ public function isUpdatable($path) {
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;
}
}
Expand All @@ -705,7 +707,7 @@ public function isDeletable($path) {
return ($this->showHidden || !$info->isHidden()) && !$info->isReadOnly();
} catch (\OCP\Files\NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
} catch (\OCP\Files\ForbiddenException $e) {
return false;
}
}
Expand Down
Loading