Skip to content

Commit

Permalink
Also take in count audio files
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
  • Loading branch information
CarlSchwan committed Nov 22, 2022
1 parent 601d15c commit d1ff6cf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/files_sharing/lib/Controller/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,14 +627,14 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS
$userFolder = $this->rootFolder->getUserFolder($share->getShareOwner());
$originalSharePath = $userFolder->getRelativePath($share->getNode()->getPath());

$isVideo = false;
$isVideoAudio = false;

// Single file share
if ($share->getNode() instanceof \OCP\Files\File) {
$node = $share->getNode();
// Single file download
$this->singleFileDownloaded($share, $node);
$isVideo = str_starts_with($node->getMimeType(), 'video/');
$isVideoAutio = str_starts_with($node->getMimeType(), 'video/') || str_starts_with($node->getMimeType(), 'audio/');
}
// Directory share
else {
Expand All @@ -658,7 +658,7 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS
$node = $share->getNode();
// Single file download
$this->singleFileDownloaded($share, $node);
$isVideo = str_starts_with($node->getMimeType(), 'video/');
$isVideoAutio = str_starts_with($node->getMimeType(), 'video/') || str_starts_with($node->getMimeType(), 'audio/');
} else {
try {
if (!empty($files_list)) {
Expand Down Expand Up @@ -692,8 +692,8 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS

$this->emitAccessShareHook($share);

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

Expand Down

0 comments on commit d1ff6cf

Please sign in to comment.