diff --git a/src/resolve/metadataResolver.ts b/src/resolve/metadataResolver.ts index 7c325a6c44..0592edb087 100644 --- a/src/resolve/metadataResolver.ts +++ b/src/resolve/metadataResolver.ts @@ -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); }; /** diff --git a/test/resolve/metadataResolver.test.ts b/test/resolve/metadataResolver.test.ts index ae693ceb0e..a6825df9e3 100644 --- a/test/resolve/metadataResolver.test.ts +++ b/test/resolve/metadataResolver.test.ts @@ -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([