Partial fix for display of UDP tracker URLs
Some checks failed
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
Daily Workflow / daily-job (push) Has been cancelled
Daily Workflow / javadoc-latest (push) Has been cancelled
Daily Workflow / build-java7 (push) Has been cancelled
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Dockerhub / docker (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Some checks failed
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
Daily Workflow / daily-job (push) Has been cancelled
Daily Workflow / javadoc-latest (push) Has been cancelled
Daily Workflow / build-java7 (push) Has been cancelled
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Dockerhub / docker (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
This commit is contained in:
@ -2476,17 +2476,20 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
private String getShortTrackerLink(String announce, byte[] infohash) {
|
||||
StringBuilder buf = new StringBuilder(128);
|
||||
String trackerLinkUrl = getTrackerLinkUrl(announce, infohash);
|
||||
if (announce.startsWith("http://"))
|
||||
boolean isUDP = false;
|
||||
if (announce.startsWith("http://")) {
|
||||
announce = announce.substring(7);
|
||||
else if (announce.startsWith("udp://"))
|
||||
} else if (announce.startsWith("udp://")) {
|
||||
announce = announce.substring(6);
|
||||
isUDP = true;
|
||||
}
|
||||
// strip path
|
||||
int slsh = announce.indexOf('/');
|
||||
if (slsh > 0)
|
||||
announce = announce.substring(0, slsh);
|
||||
if (trackerLinkUrl != null) {
|
||||
buf.append(trackerLinkUrl);
|
||||
} else {
|
||||
} else if (!isUDP) {
|
||||
// browsers don't like a full b64 dest, so convert it to b32
|
||||
String host = announce;
|
||||
if (host.length() >= 516) {
|
||||
@ -2515,7 +2518,8 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
announce = DataHelper.escapeHTML(announce.substring(0, 40)) + "…" +
|
||||
DataHelper.escapeHTML(announce.substring(announce.length() - 8));
|
||||
buf.append(announce);
|
||||
buf.append("</a>");
|
||||
if (!isUDP)
|
||||
buf.append("</a>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user