Skip to content

Commit 4e81812

Browse files
authored
Merge pull request #49146 from nextcloud/fix/undefined-response
2 parents c870608 + 954b6c6 commit 4e81812

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/private/Files/Storage/DAV.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ protected function propfind(string $path): array|false {
250250
// we either don't know it, or we know it exists but need more details
251251
if (is_null($cachedResponse) || $cachedResponse === true) {
252252
$this->init();
253+
$response = false;
253254
try {
254255
$response = $this->client->propFind(
255256
$this->encodePath($path),
@@ -260,9 +261,9 @@ protected function propfind(string $path): array|false {
260261
if ($e->getHttpStatus() === 404 || $e->getHttpStatus() === 405) {
261262
$this->statCache->clear($path . '/');
262263
$this->statCache->set($path, false);
263-
return false;
264+
} else {
265+
$this->convertException($e, $path);
264266
}
265-
$this->convertException($e, $path);
266267
} catch (\Exception $e) {
267268
$this->convertException($e, $path);
268269
}
@@ -345,7 +346,7 @@ public function fopen(string $path, string $mode) {
345346
if ($response->getStatusCode() === Http::STATUS_LOCKED) {
346347
throw new \OCP\Lock\LockedException($path);
347348
} else {
348-
Server::get(LoggerInterface::class)->error('Guzzle get returned status code ' . $response->getStatusCode(), ['app' => 'webdav client']);
349+
$this->logger->error('Guzzle get returned status code ' . $response->getStatusCode(), ['app' => 'webdav client']);
349350
}
350351
}
351352

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

0 commit comments

Comments
 (0)