Skip to content

Fix manifest import rejecting valid metadata with non-'none' language keys#531

Merged
thehabes merged 3 commits into
developmentfrom
530-manifest-import
Jul 6, 2026
Merged

Fix manifest import rejecting valid metadata with non-'none' language keys#531
thehabes merged 3 commits into
developmentfrom
530-manifest-import

Conversation

@cubap

@cubap cubap commented Jun 15, 2026

Copy link
Copy Markdown
Member

Problem

The manifest import endpoint (POST /project/import?createFrom=URL) was rejecting valid IIIF manifests when metadata values used language tags other than "none".

Root Cause

validatePayload.js only accepted:

  1. Plain string values: { value: "John Doe" }
  2. Language maps with "none" key: { value: { "none": ["John Doe"] } }

Valid IIIF manifests can use any IETF language tag ("en", "fr", "la", etc.).

Changes

  • utilities/validatePayload.js — Added validateLanguageMap() and validateMetadataField() helpers to accept any IETF language tag in metadata label and value fields. Refactored duplicated label/value validation into a single parameterized helper.
  • test/local/utility.validation.test.js — Added 5 test cases covering non-"none" language tags, mixed formats, and invalid language maps.

Testing

All 14 local tests pass, including the 5 new metadata validation tests.

Related

@cubap
cubap requested a review from thehabes as a code owner June 15, 2026 16:15
better handling during import of manifests if language maps have non-`none` objects.
@cubap
cubap force-pushed the 530-manifest-import branch from d71c513 to 1dc2f4e Compare June 15, 2026 16:18

@thehabes thehabes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some minor changes during review and testing. Tested by importing various Manifests with different kinds of valid and invalid metadata properties. I metadata as expected.

@thehabes
thehabes merged commit ca4bfab into development Jul 6, 2026
4 checks passed
@thehabes
thehabes deleted the 530-manifest-import branch July 6, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants