return new DataResponse([], Http::STATUS_FORBIDDEN);
}
+ $attributes = $share->getAttributes();
+ if ($attributes !== null && $attributes->getAttribute('permissions', 'download') === false) {
+ return new DataResponse([], Http::STATUS_FORBIDDEN);
+ }
+
try {
$node = $share->getNode();
if ($node instanceof Folder) {
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
+ $attributes = $share->getAttributes();
+ if ($attributes !== null && $attributes->getAttribute('permissions', 'download') === false) {
+ return new DataResponse([], Http::STATUS_FORBIDDEN);
+ }
+
try {
$node = $share->getNode();
if ($node instanceof Folder) {
*/
namespace OC\Core\Controller;
+use OCA\Files_Sharing\SharedStorage;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
+ $storage = $node->getStorage();
+ if ($storage->instanceOfStorage(SharedStorage::class)) {
+ /** @var SharedStorage $storage */
+ $share = $storage->getShare();
+ $attributes = $share->getAttributes();
+ if ($attributes !== null && $attributes->getAttribute('permissions', 'download') === false) {
+ return new DataResponse([], Http::STATUS_FORBIDDEN);
+ }
+ }
+
try {
$f = $this->preview->getPreview($node, $x, $y, !$a, $mode);
$response = new FileDisplayResponse($f, Http::STATUS_OK, [
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
+use OCP\Files\Storage\IStorage;
use OCP\IPreview;
use OCP\IRequest;
->with($this->equalTo('file'))
->willReturn($file);
+ $storage = $this->createMock(IStorage::class);
+ $file->method('getStorage')
+ ->willReturn($storage);
+
$this->previewManager->method('isAvailable')
->with($this->equalTo($file))
->willReturn(true);
$file->method('isReadable')
->willReturn(true);
+ $storage = $this->createMock(IStorage::class);
+ $file->method('getStorage')
+ ->willReturn($storage);
+
$preview = $this->createMock(ISimpleFile::class);
$preview->method('getName')->willReturn('my name');
$preview->method('getMTime')->willReturn(42);