mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-10-29 11:49:33 +00:00
Don't crash when using invalid characters in host name (#7791)
This commit is contained in:
parent
fe524237d4
commit
42d62ab57a
@ -19,7 +19,11 @@ public class HostnameParser {
|
||||
Matcher m = URLSPLIT_REGEX.matcher(hosturl);
|
||||
if (m.matches()) {
|
||||
scheme = m.group(1);
|
||||
host = IDN.toASCII(m.group(2));
|
||||
try {
|
||||
host = IDN.toASCII(m.group(2));
|
||||
} catch (IllegalArgumentException e) {
|
||||
host = "invalid-hostname";
|
||||
}
|
||||
if (m.group(3) == null) {
|
||||
port = -1;
|
||||
} else {
|
||||
@ -33,7 +37,11 @@ public class HostnameParser {
|
||||
} else {
|
||||
// URL does not match regex: use it anyway -> this will cause an exception on connect
|
||||
scheme = "https";
|
||||
host = IDN.toASCII(hosturl);
|
||||
try {
|
||||
host = IDN.toASCII(hosturl);
|
||||
} catch (IllegalArgumentException e) {
|
||||
host = "invalid-hostname";
|
||||
}
|
||||
port = 443;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user