diff --git a/lib/Controller/RawResponse.php b/lib/Controller/RawResponse.php index 99ebdfa..c3e238c 100644 --- a/lib/Controller/RawResponse.php +++ b/lib/Controller/RawResponse.php @@ -6,8 +6,12 @@ use \Exception; trait RawResponse { protected function returnRawResponse($fileNode) { if ($fileNode->getType() === 'dir') { - // Is there some reasonable thing to return for a directory? An html index? A tarball? - throw new Exception("Requested share is a directory, not a file."); + // If the requested path is a folder, try return its index.html. + try { + $fileNode = $fileNode->get('index.html'); + } catch (NotFoundException $e) { + return new NotFoundResponse(); + } } $content = $fileNode->getContent();