Skip to content

Commit ca241ba

Browse files
committed
fix: log which file cannot be opened
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 0e10bb5 commit ca241ba

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
@@ -458,14 +458,19 @@ public function get() {
458458
// do a if the file did not exist
459459
throw new NotFound();
460460
}
461+
$path = ltrim($this->path, '/');
461462
try {
462-
$res = $this->fileView->fopen(ltrim($this->path, '/'), 'rb');
463+
$res = $this->fileView->fopen($path, 'rb');
463464
} catch (\Exception $e) {
464465
$this->convertToSabreException($e);
465466
}
466467

467468
if ($res === false) {
468-
throw new ServiceUnavailable($this->l10n->t('Could not open file'));
469+
if ($this->fileView->file_exists($path)) {
470+
throw new ServiceUnavailable($this->l10n->t('Could not open file: %1$s, file does seem to exist', [$path]));
471+
} else {
472+
throw new ServiceUnavailable($this->l10n->t('Could not open file: %1$s, file doesn\'t seem to exist', [$path]));
473+
}
469474
}
470475

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

0 commit comments

Comments
 (0)