Skip to content

[TASK] Content Drive: Add a FILEASSET base-type → content-type resolution strategy #36279

Description

@zJaaal

Description

Content Drive's upload flow (PR #36243, issue #35575) lets the user choose Asset vs File before uploading. Semantically these are base types, but the frontend currently sends the content type variable (dotAsset / FileAsset) because base-type → content-type resolution only works for DOTASSET on the backend.

Where it breaks for FILEASSET:

  • BaseTypeToContentTypeStrategyResolver (dotCMS/src/main/java/com/dotcms/contenttype/business/BaseTypeToContentTypeStrategyResolver.java) registers a strategy only for BaseContentType.DOTASSET (DotAssetBaseTypeToContentTypeStrategyImpl, which uses DotAssetAPI.tryMatch to pick the best dotAsset content type by mime type). There is no FILEASSET strategy.
  • ContentHelper.tryToSetContentType only sets the contentlet's content type when a strategy exists for the given base type; otherwise it is skipped.
  • MapToContentletPopulator.getContentTypeInode resolves the type solely from structureInode / structureName / contentType — there is no fallback from baseType.
  • Net result: firing the NEW workflow action with only baseType: FILEASSET (no contentType) fails with "The content type or base type, is not set or is invalid."

Latent bug to fix along the way:

  • BaseTypeToContentTypeStrategyResolver.subscribe(...) ignores its baseContentType argument and always does builder.put(BaseContentType.DOTASSET, strategy), so a FILEASSET strategy can't even be registered via subscribe today.

Acceptance Criteria

  • Register a FILEASSET base-type → content-type resolution strategy so that firing the NEW workflow action with baseType: FILEASSET (no explicit contentType) resolves to the appropriate File Asset content type (default/system FileAsset, or best match if multiple FILEASSET content types exist).
  • Fix BaseTypeToContentTypeStrategyResolver.subscribe(...) so it registers the strategy under the passed baseContentType instead of always DOTASSET.
  • Add coverage (unit/integration) for resolving FILEASSET (and a regression test for the subscribe fix).
  • Once this lands, the Content Drive frontend ([TASK] Content Drive: Upload button — Asset vs File type selection #35575) can send the base type for both Asset and File instead of the content type, matching what the upload dialog actually asks.

Priority

Medium

Additional Context

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

Status
In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions