In doing a new Sitecore 10 SXA site, we decided to use the new Sitecore Content Serialization that comes with it. It’s a great feature and works well. We ran across one issue however that could cause a bit of a problem.
We noticed that media items with blob values getting updated from serialization get corrupted. This did not happen to any other field type, and it does not happen when creating new media items, only when updating the blob of an existing media item. Here are steps to recreate the issue:
First, create a new media item, serialize with SCS, and create a new item package.
In this scenario, change a field(not blob value) on the media item in Sitecore and install the original package. Result: Item is updated as expected
In this scenario, delete the media item and install the original package. Result: Item is installed as expected.
In this scenario, change or delete the blob value on the media item and install the original package. Result: package is installed and shows that the blob value being updated, however the blob value in Sitecore is now corrupted and unusable.
Specifically, this bug is critical for keeping our SXA theme js and css updated, but has been recreated for regular media items as well.
After contacting Sitecore support, there was no hotfix or update provided. It’s unclear at the time of this writing if this was fixed in Sitecore 10.1.
The workaround
The workaround for this is pretty simple, albeit, annoying. We created a delete package that delete the items that contain blobs. We don’t have many checked into source code, and this is mostly for the SXA theme JS and CSS. After the delete runs, we then re-install, rather than update..