Skip to content

Commit 34949e4

Browse files
Merge pull request #52079 from IONOS-Productivity/fix/s3_traffic_on_video_thumbnails
fix(previews): avoid large file downloads for remote movie storage
2 parents cc5ca58 + 4a924bf commit 34949e4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/private/Preview/Movie.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,15 @@ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage {
5454

5555
$result = null;
5656
if ($this->useTempFile($file)) {
57-
// try downloading 5 MB first as it's likely that the first frames are present there
58-
// in some cases this doesn't work for example when the moov atom is at the
59-
// end of the file, so if it fails we fall back to getting the full file
60-
$sizeAttempts = [5242880, null];
57+
// Try downloading 5 MB first, as it's likely that the first frames are present there.
58+
// In some cases this doesn't work, for example when the moov atom is at the
59+
// end of the file, so if it fails we fall back to getting the full file.
60+
// Unless the file is not local (e.g. S3) as we do not want to download the whole (e.g. 37Gb) file
61+
if ($file->getStorage()->isLocal()) {
62+
$sizeAttempts = [5242880, null];
63+
} else {
64+
$sizeAttempts = [5242880];
65+
}
6166
} else {
6267
// size is irrelevant, only attempt once
6368
$sizeAttempts = [null];

0 commit comments

Comments
 (0)