improved recursive if scanning ignores

This commit is contained in:
patrick-werner 2020-03-05 22:16:35 +01:00
parent b15d72a755
commit bb11af20fd
1 changed files with 6 additions and 2 deletions

View File

@ -436,6 +436,8 @@ public class ValidationEngine implements IValidatorResourceFetcher {
File f = new File(Utilities.path(src)); File f = new File(Utilities.path(src));
if (f.exists()) { if (f.exists()) {
if(isIgnoreFile(f))
return null;
if (f.isDirectory() && new File(Utilities.path(src, "package.tgz")).exists()) if (f.isDirectory() && new File(Utilities.path(src, "package.tgz")).exists())
return loadPackage(new FileInputStream(Utilities.path(src, "package.tgz")), Utilities.path(src, "package.tgz")); return loadPackage(new FileInputStream(Utilities.path(src, "package.tgz")), Utilities.path(src, "package.tgz"));
if (f.isDirectory() && new File(Utilities.path(src, "igpack.zip")).exists()) if (f.isDirectory() && new File(Utilities.path(src, "igpack.zip")).exists())
@ -547,8 +549,10 @@ public class ValidationEngine implements IValidatorResourceFetcher {
} }
private boolean isIgnoreFile(File ff) { private boolean isIgnoreFile(File ff) {
return Utilities.existsInList(ff.getName(), ".DS_Store") || Utilities.existsInList(Utilities.getFileExtension(ff.getName()).toLowerCase(), "md", "css", "js", "png", "gif", "jpg", "html", "tgz", "pack", "zip"); if (ff.getName().startsWith(".")|| ff.getAbsolutePath().contains(".git")){
return true;
}
return Utilities.existsInList(Utilities.getFileExtension(ff.getName()).toLowerCase(), "md", "css", "js", "png", "gif", "jpg", "html", "tgz", "pack", "zip");
} }
private Map<String, byte[]> loadPackage(InputStream stream, String name) throws Exception { private Map<String, byte[]> loadPackage(InputStream stream, String name) throws Exception {