Skip to content

Commit 00465dc

Browse files
authored
Merge pull request #51584 from nextcloud/backport/48793/stable30
[stable30] fix: log which file cannot be opened
2 parents 8d874b7 + e5cca48 commit 00465dc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apps/dav/lib/Connector/Sabre/File.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,14 +449,19 @@ public function get() {
449449
// do a if the file did not exist
450450
throw new NotFound();
451451
}
452+
$path = ltrim($this->path, '/');
452453
try {
453-
$res = $this->fileView->fopen(ltrim($this->path, '/'), 'rb');
454+
$res = $this->fileView->fopen($path, 'rb');
454455
} catch (\Exception $e) {
455456
$this->convertToSabreException($e);
456457
}
457458

458459
if ($res === false) {
459-
throw new ServiceUnavailable($this->l10n->t('Could not open file'));
460+
if ($this->fileView->file_exists($path)) {
461+
throw new ServiceUnavailable($this->l10n->t('Could not open file: %1$s, file does seem to exist', [$path]));
462+
} else {
463+
throw new ServiceUnavailable($this->l10n->t('Could not open file: %1$s, file doesn\'t seem to exist', [$path]));
464+
}
460465
}
461466

462467
// comparing current file size with the one in DB

0 commit comments

Comments
 (0)