aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisha M.-Kupriyanov <kupriyanov@strato.de>2025-04-09 17:40:25 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-04-24 12:52:47 +0000
commitaa9c1ddb097d9e53d745508a9259f368cad708d7 (patch)
tree45b8043cd1007e23362f0be9ec9d3fa87a3b673e
parent6c8fa2a14543583c920790b5ccb86f00f4741dec (diff)
downloadnextcloud-server-backport/52079/stable31.tar.gz
nextcloud-server-backport/52079/stable31.zip
fix(previews): avoid large file downloads for remote movie storagebackport/52079/stable31
Prevent downloading entire movie files from remote storage (e.g., S3) when the 'moov atom' is located at the end of the file. Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
-rw-r--r--lib/private/Preview/Movie.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/private/Preview/Movie.php b/lib/private/Preview/Movie.php
index ed6a277053b..7db75eb2fd6 100644
--- a/lib/private/Preview/Movie.php
+++ b/lib/private/Preview/Movie.php
@@ -65,10 +65,15 @@ class Movie extends ProviderV2 {
$result = null;
if ($this->useTempFile($file)) {
- // try downloading 5 MB first as it's likely that the first frames are present there
- // in some cases this doesn't work for example when the moov atom is at the
- // end of the file, so if it fails we fall back to getting the full file
- $sizeAttempts = [5242880, null];
+ // Try downloading 5 MB first, as it's likely that the first frames are present there.
+ // In some cases this doesn't work, for example when the moov atom is at the
+ // end of the file, so if it fails we fall back to getting the full file.
+ // Unless the file is not local (e.g. S3) as we do not want to download the whole (e.g. 37Gb) file
+ if ($file->getStorage()->isLocal()) {
+ $sizeAttempts = [5242880, null];
+ } else {
+ $sizeAttempts = [5242880];
+ }
} else {
// size is irrelevant, only attempt once
$sizeAttempts = [null];