Allow the video player on the hide download
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
33f360b58c
commit
422ba52ecb
|
@ -46,6 +46,7 @@ use OCP\AppFramework\Http\Template\ExternalShareMenuAction;
|
||||||
use OCP\AppFramework\Http\Template\LinkMenuAction;
|
use OCP\AppFramework\Http\Template\LinkMenuAction;
|
||||||
use OCP\AppFramework\Http\Template\PublicTemplateResponse;
|
use OCP\AppFramework\Http\Template\PublicTemplateResponse;
|
||||||
use OCP\Defaults;
|
use OCP\Defaults;
|
||||||
|
use OCP\Files\Folder;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\Template;
|
use OCP\Template;
|
||||||
use OCP\Share;
|
use OCP\Share;
|
||||||
|
@ -557,16 +558,16 @@ class ShareController extends AuthPublicShareController {
|
||||||
// Single file download
|
// Single file download
|
||||||
$this->singleFileDownloaded($share, $share->getNode());
|
$this->singleFileDownloaded($share, $share->getNode());
|
||||||
} else {
|
} else {
|
||||||
if ($share->getHideDownload()) {
|
try {
|
||||||
return new NotFoundResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($files_list)) {
|
if (!empty($files_list)) {
|
||||||
$this->fileListDownloaded($share, $files_list, $node);
|
$this->fileListDownloaded($share, $files_list, $node);
|
||||||
} else {
|
} else {
|
||||||
// The folder is downloaded
|
// The folder is downloaded
|
||||||
$this->singleFileDownloaded($share, $share->getNode());
|
$this->singleFileDownloaded($share, $share->getNode());
|
||||||
}
|
}
|
||||||
|
} catch (NotFoundException $e) {
|
||||||
|
return new NotFoundResponse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,8 +619,13 @@ class ShareController extends AuthPublicShareController {
|
||||||
* @param Share\IShare $share
|
* @param Share\IShare $share
|
||||||
* @param array $files_list
|
* @param array $files_list
|
||||||
* @param \OCP\Files\Folder $node
|
* @param \OCP\Files\Folder $node
|
||||||
|
* @throws NotFoundException when trying to download a folder or multiple files of a "hide download" share
|
||||||
*/
|
*/
|
||||||
protected function fileListDownloaded(Share\IShare $share, array $files_list, \OCP\Files\Folder $node) {
|
protected function fileListDownloaded(Share\IShare $share, array $files_list, \OCP\Files\Folder $node) {
|
||||||
|
if ($share->getHideDownload() && count($files_list) > 1) {
|
||||||
|
throw new NotFoundException('Downloading more than 1 file');
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($files_list as $file) {
|
foreach ($files_list as $file) {
|
||||||
$subNode = $node->get($file);
|
$subNode = $node->get($file);
|
||||||
$this->singleFileDownloaded($share, $subNode);
|
$this->singleFileDownloaded($share, $subNode);
|
||||||
|
@ -631,8 +637,12 @@ class ShareController extends AuthPublicShareController {
|
||||||
* create activity if a single file was downloaded from a link share
|
* create activity if a single file was downloaded from a link share
|
||||||
*
|
*
|
||||||
* @param Share\IShare $share
|
* @param Share\IShare $share
|
||||||
|
* @throws NotFoundException when trying to download a folder of a "hide download" share
|
||||||
*/
|
*/
|
||||||
protected function singleFileDownloaded(Share\IShare $share, \OCP\Files\Node $node) {
|
protected function singleFileDownloaded(Share\IShare $share, \OCP\Files\Node $node) {
|
||||||
|
if ($share->getHideDownload() && $node instanceof Folder) {
|
||||||
|
throw new NotFoundException('Downloading a folder');
|
||||||
|
}
|
||||||
|
|
||||||
$fileId = $node->getId();
|
$fileId = $node->getId();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue