use OC\AppFramework\Http\Request;
use OCA\DAV\Connector\Sabre\FilesPlugin;
-use OCA\Files_Versions\Versions\IVersionManager;
-use OCP\Files\NotFoundException;
+use OCP\IPreview;
use OCP\IRequest;
-use OCP\IUserSession;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\INode;
use Sabre\DAV\PropFind;
public function __construct(
private IRequest $request,
- private IVersionManager $versionManager,
- private IUserSession $userSession,
+ private IPreview $previewManager,
) {
$this->request = $request;
}
}
public function propFind(PropFind $propFind, INode $node): void {
- $user = $this->userSession->getUser();
-
if ($node instanceof VersionFile) {
$propFind->handle(self::VERSION_LABEL, fn() => $node->getLabel());
-
- if ($user !== null) {
- $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node, $user) {
- try {
- $this->versionManager->getVersionFile(
- $user,
- $node->getSourceFile(),
- $node->getVersion()->getRevisionId()
- );
- return true;
- } catch (NotFoundException $ex) {
- return false;
- }
- });
- }
+ $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, fn () => $this->previewManager->isMimeSupported($node->getContentType()));
}
}