Skip to content

Commit

Permalink
Don't consider "unassociated" child content types while matching files
Browse files Browse the repository at this point in the history
Fixes #1207
  • Loading branch information
iloveeclipse committed Feb 15, 2024
1 parent e7069db commit 3cb1453
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -711,16 +711,20 @@ private Set<ContentType> selectMatchingByName(final IScopeContext context, Colle
internalAccept(new ContentTypeVisitor() {
@Override
public int visit(ContentType type) {
if (type != root && type.hasBuiltInAssociations())
if (type != root && type.hasBuiltInAssociations()) {
// this content type has built-in associations - visit it later as root
return RETURN;
if (type == root && !type.hasFileSpec(context, fileSpecText, fileSpecType))
// it is the root and does not match the file name - do not add it nor look into its children
return RETURN;
// either the content type is the root and matches the file name or
// is a sub content type and does not have built-in files specs
if (!existing.contains(type))
destination.add(type);
}
if (type == root) {
if (!type.hasFileSpec(context, fileSpecText, fileSpecType)) {
// it is the root and does not match the file name - do not add it nor look into its children
return RETURN;
}
// the content type is the root and matches the file name
if (!existing.contains(type)) {
destination.add(type);
}
}
return CONTINUE;
}
}, root);
Expand Down

0 comments on commit 3cb1453

Please sign in to comment.