adding dot option to minimatch

Signed-off-by: Justin De Burgo <justin.deburgo@aa.com>
This commit is contained in:
Justin De Burgo
2023-02-06 12:36:57 -06:00
parent 9d456891f9
commit b3f650b1a8
2 changed files with 24 additions and 1 deletions
@@ -35,6 +35,10 @@ const entity = {
};
const location: Record<string, LocationSpec> = {
v: {
type: 'url',
target: 'https://github.com/b/c/blob/master/.folder/v.yaml',
},
w: {
type: 'url',
target: 'https://github.com/b/c/blob/master/w.yaml',
@@ -263,4 +267,20 @@ describe('DefaultCatalogRulesEnforcer', () => {
expect(enforcer.isAllowed(entity.component, location.z)).toBe(false);
});
});
it('should allow locations with a hidden folder', () => {
const enforcer = DefaultCatalogRulesEnforcer.fromConfig(
new ConfigReader({
catalog: {
rules: [
{
allow: ['Component'],
locations: [{ type: 'url', pattern: 'https://github.com/b/**' }],
},
],
},
}),
);
expect(enforcer.isAllowed(entity.component, location.v)).toBe(true);
});
});
@@ -186,7 +186,10 @@ export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer {
}
if (
matcher.pattern &&
!minimatch(location?.target, matcher.pattern, { nocase: true })
!minimatch(location?.target, matcher.pattern, {
nocase: true,
dot: true,
})
) {
continue;
}