Skip to content

Commit b110146

Browse files
CarlSchwanAndyScherzinger
authored andcommitted
Also take in count audio files
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent 948c9e2 commit b110146

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

apps/files_sharing/lib/Controller/ShareController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,14 +411,14 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS
411411
$userFolder = $this->rootFolder->getUserFolder($share->getShareOwner());
412412
$originalSharePath = $userFolder->getRelativePath($share->getNode()->getPath());
413413

414-
$isVideo = false;
414+
$isVideoAudio = false;
415415

416416
// Single file share
417417
if ($share->getNode() instanceof \OCP\Files\File) {
418418
$node = $share->getNode();
419419
// Single file download
420420
$this->singleFileDownloaded($share, $node);
421-
$isVideo = str_starts_with($node->getMimeType(), 'video/');
421+
$isVideoAutio = str_starts_with($node->getMimeType(), 'video/') || str_starts_with($node->getMimeType(), 'audio/');
422422
}
423423
// Directory share
424424
else {
@@ -442,7 +442,7 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS
442442
$node = $share->getNode();
443443
// Single file download
444444
$this->singleFileDownloaded($share, $node);
445-
$isVideo = str_starts_with($node->getMimeType(), 'video/');
445+
$isVideoAutio = str_starts_with($node->getMimeType(), 'video/') || str_starts_with($node->getMimeType(), 'audio/');
446446
} else {
447447
try {
448448
if (!empty($files_list)) {
@@ -475,8 +475,8 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS
475475

476476
$this->emitAccessShareHook($share);
477477

478-
// Ensure download limit is counted unless we are streaming a video
479-
if (!isset($_SERVER['HTTP_RANGE']) || !$isVideo) {
478+
// Ensure download limit is counted unless we are streaming a video or audio file
479+
if (!isset($_SERVER['HTTP_RANGE']) || !$isVideoAudio) {
480480
$this->emitShareAccessEvent($share, self::SHARE_DOWNLOAD);
481481
}
482482

0 commit comments

Comments
 (0)