Fixed broken links when only a line break separates the end of the link and the rest of the text

This commit is contained in:
Sylvain Berfini 2021-01-26 17:13:27 +01:00
parent f5ce0d9cdb
commit 8f116a84e4

View file

@ -318,7 +318,9 @@ public final class LinphoneUtils {
int indexHttp = text.indexOf("http://"); int indexHttp = text.indexOf("http://");
int indexFinHttp = int indexFinHttp =
text.indexOf(" ", indexHttp) == -1 text.indexOf(" ", indexHttp) == -1
? text.length() ? (text.indexOf("<br>", indexHttp) == -1
? text.length()
: text.indexOf("<br>", indexHttp))
: text.indexOf(" ", indexHttp); : text.indexOf(" ", indexHttp);
String link = text.substring(indexHttp, indexFinHttp); String link = text.substring(indexHttp, indexFinHttp);
String linkWithoutScheme = link.replace("http://", ""); String linkWithoutScheme = link.replace("http://", "");
@ -331,7 +333,9 @@ public final class LinphoneUtils {
int indexHttp = text.indexOf("https://"); int indexHttp = text.indexOf("https://");
int indexFinHttp = int indexFinHttp =
text.indexOf(" ", indexHttp) == -1 text.indexOf(" ", indexHttp) == -1
? text.length() ? (text.indexOf("<br>", indexHttp) == -1
? text.length()
: text.indexOf("<br>", indexHttp))
: text.indexOf(" ", indexHttp); : text.indexOf(" ", indexHttp);
String link = text.substring(indexHttp, indexFinHttp); String link = text.substring(indexHttp, indexFinHttp);
String linkWithoutScheme = link.replace("https://", ""); String linkWithoutScheme = link.replace("https://", "");