aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Scherzinger <info@andy-scherzinger.de>2025-04-24 14:44:34 +0200
committerGitHub <noreply@github.com>2025-04-24 14:44:34 +0200
commit34949e4a3664c06319fc7cf19bd21c757ef8994b (patch)
tree9d866377e5ac1d4216a93cb011ed5b619a5a07f5
parentcc5ca5881638b51f9dc62bc21b09891aa22ea908 (diff)
parent4a924bf400c7015bb337188fc14e1a0cb77a8d0a (diff)
downloadnextcloud-server-34949e4a3664c06319fc7cf19bd21c757ef8994b.tar.gz
nextcloud-server-34949e4a3664c06319fc7cf19bd21c757ef8994b.zip
Merge pull request #52079 from IONOS-Productivity/fix/s3_traffic_on_video_thumbnails
fix(previews): avoid large file downloads for remote movie storage
-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 46462dfa592..7de543198f4 100644
--- a/lib/private/Preview/Movie.php
+++ b/lib/private/Preview/Movie.php
@@ -54,10 +54,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];