Convert nextcloud domains to Punycode

This commit is contained in:
ByteHamster 2022-12-04 21:17:25 +01:00
parent 4513711981
commit ace0724e5d
1 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package de.danoeh.antennapod.net.sync;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.net.IDN;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -18,7 +19,7 @@ public class HostnameParser {
Matcher m = URLSPLIT_REGEX.matcher(hosturl); Matcher m = URLSPLIT_REGEX.matcher(hosturl);
if (m.matches()) { if (m.matches()) {
scheme = m.group(1); scheme = m.group(1);
host = m.group(2); host = IDN.toASCII(m.group(2));
if (m.group(3) == null) { if (m.group(3) == null) {
port = -1; port = -1;
} else { } else {
@ -32,7 +33,7 @@ public class HostnameParser {
} else { } else {
// URL does not match regex: use it anyway -> this will cause an exception on connect // URL does not match regex: use it anyway -> this will cause an exception on connect
scheme = "https"; scheme = "https";
host = hosturl; host = IDN.toASCII(hosturl);
port = 443; port = 443;
} }