Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
6edb93fc
Unverified
Commit
6edb93fc
authored
5 years ago
by
Joas Schilling
Browse files
Options
Downloads
Patches
Plain Diff
Allow the video player on the hide download
Signed-off-by:
Joas Schilling
<
coding@schilljs.com
>
parent
4a21ce27
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_sharing/lib/Controller/ShareController.php
+18
-8
18 additions, 8 deletions
apps/files_sharing/lib/Controller/ShareController.php
with
18 additions
and
8 deletions
apps/files_sharing/lib/Controller/ShareController.php
+
18
−
8
View file @
6edb93fc
...
...
@@ -55,6 +55,7 @@ use OCP\AppFramework\Http\Template\PublicTemplateResponse;
use
OCP\AppFramework\Http\Template\SimpleMenuAction
;
use
OCP\AppFramework\Http\TemplateResponse
;
use
OCP\Defaults
;
use
OCP\Files\Folder
;
use
OCP\Files\IRootFolder
;
use
OCP\Files\NotFoundException
;
use
OCP\IConfig
;
...
...
@@ -582,16 +583,16 @@ class ShareController extends AuthPublicShareController {
// Single file download
$this
->
singleFileDownloaded
(
$share
,
$share
->
getNode
());
}
else
{
if
(
$share
->
getHideDownload
())
{
try
{
if
(
!
empty
(
$files_list
))
{
$this
->
fileListDownloaded
(
$share
,
$files_list
,
$node
);
}
else
{
// The folder is downloaded
$this
->
singleFileDownloaded
(
$share
,
$share
->
getNode
());
}
}
catch
(
NotFoundException
$e
)
{
return
new
NotFoundResponse
();
}
if
(
!
empty
(
$files_list
))
{
$this
->
fileListDownloaded
(
$share
,
$files_list
,
$node
);
}
else
{
// The folder is downloaded
$this
->
singleFileDownloaded
(
$share
,
$share
->
getNode
());
}
}
}
...
...
@@ -643,8 +644,13 @@ class ShareController extends AuthPublicShareController {
* @param Share\IShare $share
* @param array $files_list
* @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
)
{
if
(
$share
->
getHideDownload
()
&&
count
(
$files_list
)
>
1
)
{
throw
new
NotFoundException
(
'Downloading more than 1 file'
);
}
foreach
(
$files_list
as
$file
)
{
$subNode
=
$node
->
get
(
$file
);
$this
->
singleFileDownloaded
(
$share
,
$subNode
);
...
...
@@ -656,8 +662,12 @@ class ShareController extends AuthPublicShareController {
* create activity if a single file was downloaded from a link 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
)
{
if
(
$share
->
getHideDownload
()
&&
$node
instanceof
Folder
)
{
throw
new
NotFoundException
(
'Downloading a folder'
);
}
$fileId
=
$node
->
getId
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment