SEBSERV-370 fixed

This commit is contained in:
anhefti 2022-12-21 10:52:39 +01:00
parent 96ce3ac3a7
commit 729dd23577
2 changed files with 22 additions and 3 deletions

View file

@ -888,4 +888,23 @@ public final class Utils {
* ((descending) ? -1 : 1);
}
public static String toFileName(final String name) {
if (name == null) {
return null;
}
return name
.replace("ä", "ae")
.replace("ö", "oe")
.replace("ü", "ue")
.replace("Ä", "Ae")
.replace("Ö", "Oe")
.replace("Ü", "Ue")
.replace("è", "e")
.replace("é", "e")
.replace("à", "a")
.replace(" ", "_")
.replaceAll("[^A-Za-z0-9_]", "");
}
}

View file

@ -14,7 +14,6 @@ import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.client.service.UrlLauncher;
import org.eclipse.swt.widgets.Composite;
@ -74,8 +73,9 @@ public class ExamCreateClientConfigPopup {
return action -> {
final DateTime now = DateTime.now(DateTimeZone.UTC);
final String downloadFileName = StringUtils.remove(examName, " ") + "_" + now.getYear() + "-"
+ now.getMonthOfYear() + "-" + now.getDayOfMonth() + ".seb";
final String downloadFileName =
Utils.toFileName(examName) + "_" + now.getYear() + "-"
+ now.getMonthOfYear() + "-" + now.getDayOfMonth() + ".seb";
final ModalInputDialog<FormHandle<?>> dialog =
new ModalInputDialog<FormHandle<?>>(