adding dot option to minimatch
Signed-off-by: Justin De Burgo <justin.deburgo@aa.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user