Skip to content

Commit

Permalink
Merge branch '5.21' into fix/asset-overview
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidmattei authored Dec 9, 2024
2 parents 4e40fcf + 7dcc1a5 commit 4f6a181
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions EMS/core-bundle/src/Service/AssetExtractorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,8 @@ public function extractMetaData(string $hash, string $file = null, bool $forced
return new ExtractedData($cacheData->getData() ?? [], $this->tikaMaxContent);
}

if ((null === $file) || !\file_exists($file)) {
$file = $this->fileService->getFile($hash);
}

if (!$file || !\file_exists($file)) {
throw new NotFoundException($hash);
}

$filesize = \filesize($file);
if (false === $filesize) {
throw new \RuntimeException('Not able to get asset size');
}
if (!$forced && \filesize($file) > (3 * 1024 * 1024)) {
$filesize = $this->fileService->getSize($hash);
if (!$forced && $filesize > (3 * 1024 * 1024)) {
$this->logger->warning('log.warning.asset_extract.file_to_large', [
'filesize' => Converter::formatBytes($filesize),
'max_size' => '3 MB',
Expand All @@ -130,6 +119,12 @@ public function extractMetaData(string $hash, string $file = null, bool $forced
return new ExtractedData([], $this->tikaMaxContent);
}

if ((null === $file) || !\file_exists($file)) {
$file = $this->fileService->getFile($hash);
}
if (!$file || !\file_exists($file)) {
throw new NotFoundException($hash);
}
$canBePersisted = true;
if (!empty($this->tikaServer)) {
try {
Expand Down

0 comments on commit 4f6a181

Please sign in to comment.