gluonhq / substrate

Create native Java(FX) apps for desktop, mobile and embedded
GNU General Public License v2.0
390 stars 52 forks source link

Invalid replace caracter in Web target on Windows #1249

Open Thihup opened 4 months ago

Thihup commented 4 months ago

Trying to build to web target from Windows fail due to file separator being used as invalid Regex.

Current Behavior

java.util.regex.PatternSyntaxException: Unescaped trailing backslash near index 1
\ 
        at java.base/java.util.regex.Pattern.error(Pattern.java:2204)
        at java.base/java.util.regex.Pattern.compile(Pattern.java:1951)
        at java.base/java.util.regex.Pattern.<init>(Pattern.java:1576)
        at java.base/java.util.regex.Pattern.compile(Pattern.java:1101)
        at java.base/java.lang.String.replaceAll(String.java:3111)
        at com.gluonhq.substrate.target.WebTargetConfiguration$1Work.setArtifact(WebTargetConfiguration.java:239)

Source

https://github.com/gluonhq/substrate/blob/8cf189f6a1b6f86404fc47d24a4529d76a02fc34/src/main/java/com/gluonhq/substrate/target/WebTargetConfiguration.java#L239

It could include two slashes instead of just one, use a regex like: "(\\\\|/)" or change the call from String::replaceAll to String::replace

Your Environment

Windows 11 - GluonFX 1.0.22