Skip to content

Commit

Permalink
fix(web/client): updateStyleSets set correct mimetype and filename (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 authored Dec 9, 2024
1 parent 1f5f4c6 commit b09eeb6
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 b09eeb6

Please sign in to comment.