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: undefined variable $response in DAV storage #49146

Merged
merged 2 commits into from
Nov 8, 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
9 changes: 5 additions & 4 deletions lib/private/Files/Storage/DAV.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ protected function propfind(string $path): array|false {
// we either don't know it, or we know it exists but need more details
if (is_null($cachedResponse) || $cachedResponse === true) {
$this->init();
$response = false;
try {
$response = $this->client->propFind(
$this->encodePath($path),
Expand All @@ -260,9 +261,9 @@ protected function propfind(string $path): array|false {
if ($e->getHttpStatus() === 404 || $e->getHttpStatus() === 405) {
$this->statCache->clear($path . '/');
$this->statCache->set($path, false);
return false;
} else {
$this->convertException($e, $path);
}
$this->convertException($e, $path);
} catch (\Exception $e) {
$this->convertException($e, $path);
}
Expand Down Expand Up @@ -345,7 +346,7 @@ public function fopen(string $path, string $mode) {
if ($response->getStatusCode() === Http::STATUS_LOCKED) {
throw new \OCP\Lock\LockedException($path);
} else {
Server::get(LoggerInterface::class)->error('Guzzle get returned status code ' . $response->getStatusCode(), ['app' => 'webdav client']);
$this->logger->error('Guzzle get returned status code ' . $response->getStatusCode(), ['app' => 'webdav client']);
}
}

Expand Down Expand Up @@ -772,7 +773,7 @@ public function hasUpdated(string $path, int $time): bool {
* @throws ForbiddenException if the action is not allowed
*/
protected function convertException(Exception $e, string $path = ''): void {
Server::get(LoggerInterface::class)->debug($e->getMessage(), ['app' => 'files_external', 'exception' => $e]);
$this->logger->debug($e->getMessage(), ['app' => 'files_external', 'exception' => $e]);
if ($e instanceof ClientHttpException) {
if ($e->getHttpStatus() === Http::STATUS_LOCKED) {
throw new \OCP\Lock\LockedException($path);
Expand Down
Loading