fileuploader_import

Import folders as media resources, optionally grouped in collections with haspart edges. Paths are validated metadata, never filesystem destinations. Import bookkeeping is stored in fileuploader_import and fileuploader_import_item, not in resource names.

All endpoints require a writable admin session. Sessions belong to the authenticated user; resource creation, reuse and connections also enforce normal resource and edge ACLs.

POST endpoints:

  • candidates: Find the most recent session matching entries and import options.
  • session: Create a session and return import_id.
  • collection: Create or reuse a collection at relative_path in import_id.
  • reuse: Return the saved file's id only if its original SHA-256 digest matches. Return an empty map for an unsaved or deleted file, or file_changed for different content.
  • link: Retry connecting a saved file to its collection.

The manifest entries contains maps with path and boolean directory. Files also have size (bytes) and modified (milliseconds since the epoch). At most 10,000 distinct paths and 1 MiB of combined path text are accepted. Options include nested, is_published, subject_id, predicate, collection_category and content_group_id. Options are fixed when the session is created; per-file requests cannot redirect a resumed import to a different destination.

Matching uses the full manifest and options. The UI explicitly offers resume or a new import, including for completed sessions whose final response might have been lost. File content is verified before reuse. Resource insertion and recording its ID share a transaction; file connection progress is recorded separately so connection failures can be retried.

Sessions expire after 30 days of inactivity. Daily cleanup deletes only session bookkeeping, never imported resources. Older name-based imports cannot be resumed through these sessions; existing resource names are left unchanged. Per user, bookkeeping is limited to 100 sessions, 100,000 items and 10 MiB of path text; concurrent session creation shares a database lock.

Edit on GitHub