public static boolean checkListingMask ( final ArtifactStore store , final String path ) { Set < String > maskPatterns = store . getPathMaskPatterns ( ) ; logger . trace ( "Checking mask in: {}" , store . getKey ( ) ) ; logger . trace ( "Mask patterns in {}: {}" , store . getName ( ) , maskPatterns ) ; if ( maskPatterns == null || maskPatterns . isEmpty ( ) ) { logger . trace ( "Checking mask in: {}, - NO PATTERNS" , store . getName ( ) ) ; return true ; } for ( String pattern : maskPatterns ) { if ( isRegexPattern ( pattern ) ) { // if there is a regexp pattern we cannot check presence of directory listing, because we would have to // check only the beginning of the regexp and that's impossible, so we have to assume that the path is // present return true ; } } for ( String pattern : maskPatterns ) { if ( path . startsWith ( pattern ) || pattern . startsWith ( path ) ) { logger . trace ( "Checking mask in: {}, pattern: {} - MATCH" , store . getName ( ) , pattern ) ; return true ; } } logger . debug ( "Listing for path {} not enabled by path mask {} of repo {}" , path , maskPatterns , store . getKey ( ) ) ; return false ; }
path mask checking