From fe533750d194b439d7dee5f93352c2d1da00bfde Mon Sep 17 00:00:00 2001 From: frcroth Date: Wed, 18 Dec 2024 09:47:17 +0100 Subject: [PATCH] Don't require zarr 3 Bytes Codec configuration key (#8282) --- CHANGELOG.unreleased.md | 3 ++- .../datareaders/zarr3/Zarr3ArrayHeader.scala | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index e4e02843cd..1f0225d766 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -28,13 +28,14 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Fixed a bug that uploading a zarr dataset with an already existing `datasource-properties.json` file failed. [#8268](https://github.com/scalableminds/webknossos/pull/8268) - Fixed the organization switching feature for datasets opened via old links. [#8257](https://github.com/scalableminds/webknossos/pull/8257) - Fixed that uploading an NML file without an organization id failed. Now the user's organization is used as fallback. [#8277](https://github.com/scalableminds/webknossos/pull/8277) -- Fixed that the frontend did not ensure a minium length for annotation layer names. Moreover, names starting with a `.` are also disallowed now. [#8244](https://github.com/scalableminds/webknossos/pull/8244) +- Fixed that the frontend did not ensure a minimum length for annotation layer names. Moreover, names starting with a `.` are also disallowed now. [#8244](https://github.com/scalableminds/webknossos/pull/8244) - Fixed a bug where in the add remote dataset view the dataset name setting was not in sync with the datasource setting of the advanced tab making the form not submittable. [#8245](https://github.com/scalableminds/webknossos/pull/8245) - Fix read and update dataset route for versions 8 and lower. [#8263](https://github.com/scalableminds/webknossos/pull/8263) - Fixed that task bounding boxes are again converted to user bounding boxes when uploading annotations via nmls. [#8280](https://github.com/scalableminds/webknossos/pull/8280) - Added missing legacy support for `isValidNewName` route. [#8252](https://github.com/scalableminds/webknossos/pull/8252) - Fixed some layout issues in the upload view. [#8231](https://github.com/scalableminds/webknossos/pull/8231) - Fixed `FATAL: role "postgres" does not exist` error message in Docker compose. [#8240](https://github.com/scalableminds/webknossos/pull/8240) +- Fixed the Zarr 3 implementation not accepting BytesCodec without "configuration" key. [#8282](https://github.com/scalableminds/webknossos/pull/8282) ### Removed - Removed support for HTTP API versions 3 and 4. [#8075](https://github.com/scalableminds/webknossos/pull/8075) diff --git a/webknossos-datastore/app/com/scalableminds/webknossos/datastore/datareaders/zarr3/Zarr3ArrayHeader.scala b/webknossos-datastore/app/com/scalableminds/webknossos/datastore/datareaders/zarr3/Zarr3ArrayHeader.scala index 1706960b23..4d4caf2696 100644 --- a/webknossos-datastore/app/com/scalableminds/webknossos/datastore/datareaders/zarr3/Zarr3ArrayHeader.scala +++ b/webknossos-datastore/app/com/scalableminds/webknossos/datastore/datareaders/zarr3/Zarr3ArrayHeader.scala @@ -211,12 +211,19 @@ object Zarr3ArrayHeader extends JsonImplicits { val codecSpecs = rawCodecSpecs.map(c => { for { spec: CodecConfiguration <- c("name") match { - case JsString(BytesCodecConfiguration.name) => c(configurationKey).validate[BytesCodecConfiguration] - case JsString(BytesCodecConfiguration.legacyName) => c(configurationKey).validate[BytesCodecConfiguration] - case JsString(TransposeCodecConfiguration.name) => c(configurationKey).validate[TransposeCodecConfiguration] - case JsString(GzipCodecConfiguration.name) => c(configurationKey).validate[GzipCodecConfiguration] - case JsString(BloscCodecConfiguration.name) => c(configurationKey).validate[BloscCodecConfiguration] - case JsString(ZstdCodecConfiguration.name) => c(configurationKey).validate[ZstdCodecConfiguration] + // BytesCodec may have no "configuration" key + case JsString(BytesCodecConfiguration.name) => + (c \ configurationKey).toOption + .map(_.validate[BytesCodecConfiguration]) + .getOrElse(JsSuccess(BytesCodecConfiguration(None))) + case JsString(BytesCodecConfiguration.legacyName) => + (c \ configurationKey).toOption + .map(_.validate[BytesCodecConfiguration]) + .getOrElse(JsSuccess(BytesCodecConfiguration(None))) + case JsString(TransposeCodecConfiguration.name) => c(configurationKey).validate[TransposeCodecConfiguration] + case JsString(GzipCodecConfiguration.name) => c(configurationKey).validate[GzipCodecConfiguration] + case JsString(BloscCodecConfiguration.name) => c(configurationKey).validate[BloscCodecConfiguration] + case JsString(ZstdCodecConfiguration.name) => c(configurationKey).validate[ZstdCodecConfiguration] case JsString(Crc32CCodecConfiguration.name) => JsSuccess(Crc32CCodecConfiguration) // Crc32 codec has no configuration case JsString(ShardingCodecConfiguration.name) => readShardingCodecConfiguration(c(configurationKey))