Skip to content

Commit

Permalink
Merge branch '5.22' into 5.23
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidmattei committed Dec 9, 2024
2 parents b09eeb6 + 5bda5be commit f10c6fb
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 41 deletions.
2 changes: 2 additions & 0 deletions EMS/common-bundle/src/Storage/Processor/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ public static function fixFileExtension(string $filename, string $mimeType): str
'application/vnd.ms-excel' => 'xls',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx',
'application/xml' => 'xml',
'application/x-xliff+xml' => 'xlf',
'application/xliff+xml' => 'xlf',
'image/x-xpixmap' => 'xpm',
'image/x-xwindowdump' => 'xwd',
'text/yaml' => 'yml',
Expand Down
14 changes: 8 additions & 6 deletions EMS/core-bundle/assets/js/EmsListeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,22 +361,24 @@ export default class EmsListeners {
},
onUploaded: function(assetUrl, previewUrl){
viewButton.attr('href', assetUrl);
viewButton.removeClass("disabled");
clearButton.removeClass("disabled");
previewTab.removeClass('hidden');
uploadTab.addClass('hidden');


const imageTypes = ['image/png','image/jpeg','image/webp']
if(imageTypes.includes(fileHandler.type)) {
self._resizeImage(fileHandler, container, previewUrl);
}
else if(metaFields && $(contentInput).length) {
previewLink.attr('src', previewUrl)
self.fileDataExtrator(container);
}
else if(typeof self.onChangeCallback === "function"){
previewLink.attr('src', previewUrl)
self.onChangeCallback();
} else {
previewLink.attr('src', previewUrl)
}
viewButton.removeClass("disabled");
clearButton.removeClass("disabled");
previewTab.removeClass('hidden');
uploadTab.addClass('hidden');
},
onError: function(message, code){
$(progressBar).css('width', '0%');
Expand Down
6 changes: 6 additions & 0 deletions EMS/core-bundle/src/Command/JobOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
namespace EMS\CoreBundle\Command;

use EMS\CoreBundle\Repository\JobRepository;
use EMS\Helpers\Standard\Json;
use Symfony\Component\Console\Output\Output;

class JobOutput extends Output
{
private const JOB_VERBOSITY = self::VERBOSITY_NORMAL;
private bool $newLine = true;

public function __construct(private readonly JobRepository $jobRepository, private readonly int $jobId)
{
Expand All @@ -34,6 +36,10 @@ public function progress(int $progress): void

public function doWrite(string $message, bool $newline): void
{
if (!$newline && !$this->newLine && Json::isJson($message)) {
$newline = true;
}
$this->newLine = $newline;
$job = $this->jobRepository->findById($this->jobId);
$job->setStatus($message);
$job->setOutput(self::concatenateAnsiString($job->getOutput() ?? '', $this->getFormatter()->format($message) ?? '').($newline ? PHP_EOL : ''));
Expand Down
12 changes: 10 additions & 2 deletions EMS/core-bundle/src/Command/Xliff/ExtractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
[
EmsFields::CONTENT_FILE_HASH_FIELD => $hash,
EmsFields::CONTENT_FILE_NAME_FIELD => \basename($this->xliffBasename),
EmsFields::CONTENT_MIME_TYPE_FIELD => MimeTypes::APPLICATION_XML->value,
EmsFields::CONTENT_MIME_TYPE_FIELD => $this->getMimetype(),
],
[],
'ems_asset',
Expand Down Expand Up @@ -229,8 +229,16 @@ private function sendEmail(TempFile $tempFile): void
'query' => $this->searchQuery,
'fields' => $this->fields,
]);
$mailTemplate->addAttachment($tempFile->path, \basename($this->xliffBasename), MimeTypes::APPLICATION_XML->value);
$mailTemplate->addAttachment($tempFile->path, \basename($this->xliffBasename), $this->getMimetype());

$this->mailerService->sendMailTemplate($mailTemplate);
}

private function getMimetype(): string
{
return match ($this->xliffVersion) {
Extractor::XLIFF_1_2 => MimeTypes::APPLICATION_XLIFF_LEGACY->value,
default => MimeTypes::APPLICATION_XLIFF->value,
};
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions EMS/core-bundle/src/Resources/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@
"yellow-light.css": "bundles/emscore/css/yellow-light.d49e5306580cfb1f6833.css",
"yellow-light.js": "bundles/emscore/js/yellow-light.31d6cfe0d16ae931b73c.js",
"app.css": "bundles/emscore/css/app.deef6efefc4264c8968f.css",
"app.js": "bundles/emscore/js/app.827aba59cec0bf699a85.js",
"app.js": "bundles/emscore/js/app.d79a0dcca6e88b778571.js",
"edit-revision.css": "bundles/emscore/css/edit-revision.deef6efefc4264c8968f.css",
"edit-revision.js": "bundles/emscore/js/edit-revision.1d246eb3b18eebaa2b72.js",
"edit-revision.js": "bundles/emscore/js/edit-revision.0d72d9f7cbdd483d83f4.js",
"managed-alias.css": "bundles/emscore/css/managed-alias.f78ee5f58a2f547f8ae3.css",
"managed-alias.js": "bundles/emscore/js/managed-alias.b1b96d06f004d3a761b7.js",
"managed-alias.js": "bundles/emscore/js/managed-alias.989c583ad8bef814f301.js",
"user-profile.css": "bundles/emscore/css/user-profile.f78ee5f58a2f547f8ae3.css",
"user-profile.js": "bundles/emscore/js/user-profile.91350895c59e17099164.js",
"user-profile.js": "bundles/emscore/js/user-profile.c57f337ecfc2a0fc79c4.js",
"template.css": "bundles/emscore/css/template.f78ee5f58a2f547f8ae3.css",
"template.js": "bundles/emscore/js/template.c9229a576a1c5d0b20cb.js",
"template.js": "bundles/emscore/js/template.a5b0205ead3f0ba963f2.js",
"hierarchical.css": "bundles/emscore/css/hierarchical.f78ee5f58a2f547f8ae3.css",
"hierarchical.js": "bundles/emscore/js/hierarchical.77726249f92b40e60ed4.js",
"hierarchical.js": "bundles/emscore/js/hierarchical.84d9203a1cafc6b6c19f.js",
"calendar.css": "bundles/emscore/css/calendar.f78ee5f58a2f547f8ae3.css",
"calendar.js": "bundles/emscore/js/calendar.c8298e242581bb102cb6.js",
"calendar.js": "bundles/emscore/js/calendar.8565f8014ff4072205f2.js",
"criteria-view.css": "bundles/emscore/css/criteria-view.f78ee5f58a2f547f8ae3.css",
"criteria-view.js": "bundles/emscore/js/criteria-view.c24dc6bea79666f3930a.js",
"criteria-view.js": "bundles/emscore/js/criteria-view.8180047b5fceee18cd65.js",
"criteria-table.css": "bundles/emscore/css/criteria-table.f78ee5f58a2f547f8ae3.css",
"criteria-table.js": "bundles/emscore/js/criteria-table.31210f2378a04eee2cb2.js",
"criteria-table.js": "bundles/emscore/js/criteria-table.e9bd6556afca2ab1afe5.js",
"i18n.css": "bundles/emscore/css/i18n.f78ee5f58a2f547f8ae3.css",
"i18n.js": "bundles/emscore/js/i18n.bba904a6a3078a2edc8e.js",
"i18n.js": "bundles/emscore/js/i18n.0827b5913fdee8267223.js",
"dashboard-browser.css": "bundles/emscore/css/dashboard-browser.0ca4a46888d56dc2418f.css",
"dashboard-browser.js": "bundles/emscore/js/dashboard-browser.b827d809f0a027d92b63.js",
"js/ace/worker-xquery.js": "bundles/emscore/js/ace/worker-xquery.js",
Expand Down
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
2 changes: 2 additions & 0 deletions EMS/helpers/src/Html/MimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ enum MimeTypes: string
{
case APPLICATION_ZIP = 'application/zip';
case APPLICATION_GZIP = 'application/x-gzip-compressed';
case APPLICATION_XLIFF_LEGACY = 'application/x-xliff+xml';
case APPLICATION_XLIFF = 'application/xliff+xml';
case APPLICATION_XML = 'application/xml';
case APPLICATION_JSON = 'application/json';
case APPLICATION_OCTET_STREAM = 'application/octet-stream';
Expand Down

0 comments on commit f10c6fb

Please sign in to comment.