mirror of
https://github.com/github/codeql.git
synced 2026-01-05 18:50:23 +01:00
actually extract .html.erb files
This commit is contained in:
@@ -104,7 +104,7 @@ public class FileExtractor {
|
||||
|
||||
/** Information about supported file types. */
|
||||
public static enum FileType {
|
||||
HTML(".htm", ".html", ".xhtm", ".xhtml", ".vue", ".hbs", ".ejs", ".njk", ".html.erb") {
|
||||
HTML(".htm", ".html", ".xhtm", ".xhtml", ".vue", ".hbs", ".ejs", ".njk", ".erb") {
|
||||
@Override
|
||||
public IExtractor mkExtractor(ExtractorConfig config, ExtractorState state) {
|
||||
return new HTMLExtractor(config, state);
|
||||
@@ -120,6 +120,12 @@ public class FileExtractor {
|
||||
if (isBinaryFile(f, lcExt, config)) {
|
||||
return false;
|
||||
}
|
||||
// for ERB files we are only interrested in `.html.erb` files
|
||||
if (FileUtil.extension(f).equalsIgnoreCase(".erb")) {
|
||||
if (!f.getName().endsWith(".html.erb")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.contains(f, lcExt, config);
|
||||
}
|
||||
},
|
||||
@@ -350,7 +356,7 @@ public class FileExtractor {
|
||||
|
||||
/** Determine the {@link FileType} for a given file based on its extension only. */
|
||||
public static FileType forFileExtension(File f) {
|
||||
String lcExt = StringUtil.lc(FileUtil.extension(f));
|
||||
String lcExt = StringUtil.lc(FileUtil.extension(f)); // TODO: Here, it doesn't recognize .html.erb files
|
||||
for (FileType tp : values())
|
||||
if (tp.getExtensions().contains(lcExt)) {
|
||||
return tp;
|
||||
|
||||
Reference in New Issue
Block a user