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
Priority
Medium
Additional Context
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 forDOTASSETon the backend.Where it breaks for
FILEASSET:BaseTypeToContentTypeStrategyResolver(dotCMS/src/main/java/com/dotcms/contenttype/business/BaseTypeToContentTypeStrategyResolver.java) registers a strategy only forBaseContentType.DOTASSET(DotAssetBaseTypeToContentTypeStrategyImpl, which usesDotAssetAPI.tryMatchto pick the best dotAsset content type by mime type). There is noFILEASSETstrategy.ContentHelper.tryToSetContentTypeonly sets the contentlet's content type when a strategy exists for the given base type; otherwise it is skipped.MapToContentletPopulator.getContentTypeInoderesolves the type solely fromstructureInode/structureName/contentType— there is no fallback frombaseType.NEWworkflow action with onlybaseType: FILEASSET(nocontentType) fails with "The content type or base type, is not set or is invalid."Latent bug to fix along the way:
BaseTypeToContentTypeStrategyResolver.subscribe(...)ignores itsbaseContentTypeargument and always doesbuilder.put(BaseContentType.DOTASSET, strategy), so aFILEASSETstrategy can't even be registered viasubscribetoday.Acceptance Criteria
FILEASSETbase-type → content-type resolution strategy so that firing theNEWworkflow action withbaseType: FILEASSET(no explicitcontentType) resolves to the appropriate File Asset content type (default/systemFileAsset, or best match if multipleFILEASSETcontent types exist).BaseTypeToContentTypeStrategyResolver.subscribe(...)so it registers the strategy under the passedbaseContentTypeinstead of alwaysDOTASSET.FILEASSET(and a regression test for thesubscribefix).Priority
Medium
Additional Context
DotAssetBaseTypeToContentTypeStrategyImpl+DotAssetAPIImpl.tryMatch.