folder-share: prevent files

pull/465/head
Varun Patil 2023-03-09 18:55:22 -08:00
parent bd85a16f02
commit f136d511da
1 changed files with 10 additions and 0 deletions

View File

@ -106,6 +106,11 @@ class PublicController extends AuthPublicShareController
throw new NotFoundException();
}
if (!($share->getNode() instanceof \OCP\Files\Folder)) {
// TODO: single file share
throw new NotFoundException();
}
// Redirect to main app if user owns this share
$this->redirectIfOwned($share);
@ -207,6 +212,11 @@ class PublicController extends AuthPublicShareController
return null;
}
// Check if node is a folder
if (!$node instanceof \OCP\Files\Folder) {
return null;
}
// Remove user folder path from start of node path
$relPath = substr($node->getPath(), \strlen($userFolder->getPath()));