Skip to content

Commit

Permalink
fix: right styleset's assets mimetype and filename
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 committed Dec 9, 2024
1 parent 1f5f4c6 commit 22e56aa
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions EMS/client-helper-bundle/src/Command/Local/UploadAssetsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,22 @@ private function updateStyleSets(string $hash): void
if (empty($styleSetNames)) {
return;
}
foreach ($styleSetNames as $name) {
$styleSet = $styleSetClient->get($name);
$styleSet['properties']['assets'] = [
$archive = match ($this->archiveType) {
self::ARCHIVE_ZIP => [
EmsFields::CONTENT_FILE_HASH_FIELD => $hash,
EmsFields::CONTENT_MIME_TYPE_FIELD => MimeTypes::APPLICATION_ZIP,
EmsFields::CONTENT_FILE_NAME_FIELD => 'bundle.zip',
];
$styleSetClient->update($name, $styleSet);
],
self::ARCHIVE_EMS => [
EmsFields::CONTENT_FILE_HASH_FIELD => $hash,
EmsFields::CONTENT_MIME_TYPE_FIELD => MimeTypes::APPLICATION_JSON,
EmsFields::CONTENT_FILE_NAME_FIELD => 'bundle.json',
],
default => throw new \RuntimeException(\sprintf('Unknown archive type "%s"', $this->archiveType)),
};
foreach ($styleSetNames as $name) {
$styleSet = $styleSetClient->get($name);
$styleSet['properties']['assets'] = $archive;
}
$this->io->success(\sprintf('%d style sets have been updated', \count($styleSetNames)));
}
Expand Down

0 comments on commit 22e56aa

Please sign in to comment.