@@ -627,11 +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 ;
630631
631632 // Single file share
632633 if ($ share ->getNode () instanceof \OCP \Files \File) {
634+ $ node = $ share ->getNode ();
633635 // Single file download
634- $ this ->singleFileDownloaded ($ share , $ share ->getNode ());
636+ $ this ->singleFileDownloaded ($ share , $ node );
637+ $ isVideo = str_starts_with ($ node ->getMimeType (), 'video/ ' );
635638 }
636639 // Directory share
637640 else {
@@ -652,8 +655,10 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS
652655 $ originalSharePath = $ userFolder ->getRelativePath ($ node ->getPath ());
653656
654657 if ($ node instanceof \OCP \Files \File) {
658+ $ node = $ share ->getNode ();
655659 // Single file download
656- $ this ->singleFileDownloaded ($ share , $ share ->getNode ());
660+ $ this ->singleFileDownloaded ($ share , $ node );
661+ $ isVideo = str_starts_with ($ node ->getMimeType (), 'video/ ' );
657662 } else {
658663 try {
659664 if (!empty ($ files_list )) {
@@ -686,7 +691,9 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS
686691 }
687692
688693 $ this ->emitAccessShareHook ($ share );
689- if (!isset ($ _SERVER ['HTTP_RANGE ' ])) {
694+
695+ // Ensure download limit is counted unless we are streaming a video
696+ if (!isset ($ _SERVER ['HTTP_RANGE ' ]) || !$ isVideo ) {
690697 $ this ->emitShareAccessEvent ($ share , self ::SHARE_DOWNLOAD );
691698 }
692699
0 commit comments