Skip to content

Manifest import rejects valid metadata with non-'none' language keys #530

Description

@cubap

Problem

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

Root Cause

In validatePayload.js, metadata validation only accepts:

  1. Plain string values: { value: "John Doe" }
  2. Language maps with "none" key: { value: { "none": ["John Doe"] } }
if (typeof metadataItem.value?.none?.[0] !== 'string' && typeof metadataItem.value !== 'string')
  return { isValid: false, errors: 'metadata item value cannot be processed' }

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

{ "label": { "en": ["Author"] }, "value": { "en": ["John Doe"] } }

will be rejected because value?.none?.[0] is undefined and value is an object.

Impact

Related to TPEN-interfaces#567 — users see opaque import errors when importing manifests with language-specific metadata.

Fix

Relax the validation in validatePayload.js to accept any language key in metadata label and value fields, not just "none". Also ensure ProjectFactory properly handles language-mapped metadata values during project creation.

Files to Check

  • validatePayload.js — metadata validation logic
  • ProjectFactory.jsDBObjectFromManifest() metadata extraction

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions