From 56fa69844186155b9645220c90f3ba6327684d9c Mon Sep 17 00:00:00 2001
From: "Lange, Dr. Herbert" <herbert.lange@uni-hamburg.de>
Date: Thu, 22 Sep 2022 15:09:49 +0200
Subject: [PATCH] handle * in file extensions

---
 src/main/resources/static/main.js    | 4 +++-
 src/main/resources/templates/root.vm | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/static/main.js b/src/main/resources/static/main.js
index 6210810..54fc914 100644
--- a/src/main/resources/static/main.js
+++ b/src/main/resources/static/main.js
@@ -16,9 +16,10 @@ var count;
 function do_the_sending(corpus_files,file_exts,resolve) {
   for (var i = 0 ; i <corpus_files.length; i++) {
     file_exts.forEach(function(e) {
-      if (corpus_files[i].name.endsWith(e)) {
+      if (corpus_files[i].name.endsWith(e.replace("\*.","")) || e == "*") {
         var reader = new FileReader();
         reader.addEventListener("load", ((name) => { return () => {
+          console.log("send file " + name)
           var content = reader.result;
           --count;
           $.ajax({
@@ -56,6 +57,7 @@ function send_files() {
     var functions = []
     $("#corpus_checker_form input:checked").each((index,element) => functions.push(element.value));
     var url = "check_corpus?input=tmp&output=tmp&functions=" + functions.join(",") + "&token=tmp&callback="
+    console.log("call url " + url)
     $.ajax({
       url: url,
       type: "GET",
diff --git a/src/main/resources/templates/root.vm b/src/main/resources/templates/root.vm
index 5d84b09..bd4f8d3 100644
--- a/src/main/resources/templates/root.vm
+++ b/src/main/resources/templates/root.vm
@@ -18,7 +18,8 @@
   </div>
   <!-- Filtering by file extension -->
   <div class="row">
-    <label of="file-exts">File filter (by file extensions):</label>
+    <label of="file-exts">File filter (by file extensions, comma-separated, either in the form exb or *.exb and *
+    matching everything):</label>
     <input type="text" id="file-exts" value="*">
   </div>
   <!-- Config file selector -->
-- 
GitLab