Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -2320,6 +2320,18 @@
*/
'files_external_allow_create_new_local' => true,

/**
* Controls whether to attempt downloading the entire file for preview generation
* on non-local storage (e.g., S3, WebDAV) when the initial 5 MB chunk fails to provide
* sufficient data for a preview. By default, only the first 5 MB of a file is parsed.
*
* Enabling this option may significantly increase bandwidth usage and processing time
* for large files on external storages.
*
* * Defaults to ``false``
*/
'files_external_full_previews' => false,

/**
* Specifies how often the local filesystem (the Nextcloud data/ directory, and
* NFS mounts in data/) is checked for changes made outside Nextcloud. This
Expand Down
10 changes: 4 additions & 6 deletions lib/private/Preview/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

class Movie extends ProviderV2 {
private IConfig $config;

private ?string $binary = null;

public function __construct(array $options = []) {
Expand Down Expand Up @@ -57,11 +56,10 @@ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage {
// 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];
$sizeAttempts = [5242880];
$fullPreviews = $this->config->getSystemValueBool('files_external_full_previews', false);
if ($file->getStorage()->isLocal() || $fullPreviews === true) {
$sizeAttempts[] = null;
}
} else {
// size is irrelevant, only attempt once
Expand Down
Loading