Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/resolve/metadataResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,8 @@ const parseAsContentMetadataXml =
const matchesSuffixType = fsPath.split(sep).includes(suffixType.directoryName);
if (matchesSuffixType) return matchesSuffixType;

// it might be a type that requires strict parent folder name.
const strictFolderSuffixType = registry
.getStrictFolderTypes()
.find((l) => l.suffix === suffixType.suffix && l.directoryName && l.name !== suffixType.name);
if (!strictFolderSuffixType) return false;

return fsPath.split(sep).includes(strictFolderSuffixType.directoryName);
// at this point, the suffixType is not a match, so check for strict folder types
return !!resolveTypeFromStrictFolder(registry)(fsPath);
};

/**
Expand Down
23 changes: 23 additions & 0 deletions test/resolve/metadataResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,29 @@ describe('MetadataResolver', () => {
expect(mdResolver.getComponentsFromPath(nonMetadataDirPath, filter)).to.deep.equal([]);
});

it('Should resolve RestrictionRules metadata in mdapi format', () => {
const unpackagedPath = 'unpackaged';
const packageXmlPath = join(unpackagedPath, 'package.xml');
const restrictionRulesPath = join('unpackaged', 'restrictionRules');
const restrictionRulePath = join(restrictionRulesPath, 'Foo.rule');
const treeContainer = VirtualTreeContainer.fromFilePaths([
unpackagedPath,
packageXmlPath,
restrictionRulesPath,
restrictionRulePath,
]);
const restrictionRuleComponent = new SourceComponent(
{
name: 'Foo',
type: registry.types.restrictionrule,
xml: restrictionRulePath,
},
treeContainer
);
const mdResolver = new MetadataResolver(undefined, treeContainer, false);
expect(mdResolver.getComponentsFromPath(unpackagedPath)).to.deep.equal([restrictionRuleComponent]);
});

it('Should not return a component if path to folder metadata xml is forceignored', () => {
const path = xmlInFolder.FOLDER_XML_PATH;
const access = testUtil.createMetadataResolver([
Expand Down
Loading