Skip to content

Commit

Permalink
fix: Read from local file stream to avoid locking during preview gene…
Browse files Browse the repository at this point in the history
…ration

Signed-off-by: Julius Knorr <[email protected]>
  • Loading branch information
juliusknorr committed Jan 31, 2025
1 parent ee6f5b8 commit 274484e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/Service/RemoteService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,11 @@ public function fetchTargetThumbnail(File $file, string $target): ?string {
}

private function getRequestOptionsForFile(File $file, ?string $target = null): array {
$useTempFile = $file->isEncrypted() || !$file->getStorage()->isLocal();
if ($useTempFile) {
$localFile = $file->getStorage()->getLocalFile($file->getInternalPath());
if (!is_string($localFile)) {
throw new NotFoundException('Could not get local file');
}
$stream = fopen($localFile, 'rb');
} else {
$stream = $file->fopen('rb');
$localFile = $file->getStorage()->getLocalFile($file->getInternalPath());
if (!is_string($localFile)) {
throw new NotFoundException('Could not get local file');
}
$stream = fopen($localFile, 'rb');

$options = RemoteOptionsService::getDefaultOptions(25);
$options['multipart'] = [
Expand Down

0 comments on commit 274484e

Please sign in to comment.