Skip to content

Commit d1ff6cf

Browse files
committed
Also take in count audio files
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent 601d15c commit d1ff6cf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

apps/files_sharing/lib/Controller/ShareController.php

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

630-
$isVideo = false;
630+
$isVideoAudio = false;
631631

632632
// Single file share
633633
if ($share->getNode() instanceof \OCP\Files\File) {
634634
$node = $share->getNode();
635635
// Single file download
636636
$this->singleFileDownloaded($share, $node);
637-
$isVideo = str_starts_with($node->getMimeType(), 'video/');
637+
$isVideoAutio = str_starts_with($node->getMimeType(), 'video/') || str_starts_with($node->getMimeType(), 'audio/');
638638
}
639639
// Directory share
640640
else {
@@ -658,7 +658,7 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS
658658
$node = $share->getNode();
659659
// Single file download
660660
$this->singleFileDownloaded($share, $node);
661-
$isVideo = str_starts_with($node->getMimeType(), 'video/');
661+
$isVideoAutio = str_starts_with($node->getMimeType(), 'video/') || str_starts_with($node->getMimeType(), 'audio/');
662662
} else {
663663
try {
664664
if (!empty($files_list)) {
@@ -692,8 +692,8 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS
692692

693693
$this->emitAccessShareHook($share);
694694

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

0 commit comments

Comments
 (0)