X-Git-Url: https://git.pterodactylus.net/?p=rhynodge.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Frhynodge%2Ftriggers%2FNewTorrentTrigger.java;h=2803bb5c653782788b58ab5077075013a7dae086;hp=a21a8d6ea943021bb412dc6b7d0c0743a4eb7dab;hb=6ec36ef950c23c135bf0e112d932c5b7068189b8;hpb=eee108815d981f253877848e1fa60952219e5bff diff --git a/src/main/java/net/pterodactylus/rhynodge/triggers/NewTorrentTrigger.java b/src/main/java/net/pterodactylus/rhynodge/triggers/NewTorrentTrigger.java index a21a8d6..2803bb5 100644 --- a/src/main/java/net/pterodactylus/rhynodge/triggers/NewTorrentTrigger.java +++ b/src/main/java/net/pterodactylus/rhynodge/triggers/NewTorrentTrigger.java @@ -96,8 +96,12 @@ public class NewTorrentTrigger implements Trigger { plainText.append(torrentFile.name()).append('\n'); plainText.append('\t').append(torrentFile.size()).append(" in ").append(torrentFile.fileCount()).append(" file(s)\n"); plainText.append('\t').append(torrentFile.seedCount()).append(" seed(s), ").append(torrentFile.leechCount()).append(" leecher(s)\n"); - plainText.append('\t').append(torrentFile.magnetUri()).append('\n'); - plainText.append('\t').append(torrentFile.downloadUri()).append('\n'); + if ((torrentFile.magnetUri() != null) && (torrentFile.magnetUri().length() > 0)) { + plainText.append('\t').append(torrentFile.magnetUri()).append('\n'); + } + if ((torrentFile.downloadUri() != null) && (torrentFile.downloadUri().length() > 0)) { + plainText.append('\t').append(torrentFile.downloadUri()).append('\n'); + } plainText.append('\n'); } return plainText.toString(); @@ -119,8 +123,12 @@ public class NewTorrentTrigger implements Trigger { htmlText.append("
  • ").append(StringEscapeUtils.escapeHtml4(torrentFile.name())).append("
  • "); htmlText.append("
    Size: ").append(StringEscapeUtils.escapeHtml4(torrentFile.size())).append(" in ").append(torrentFile.fileCount()).append(" file(s)
    "); htmlText.append("
    ").append(torrentFile.seedCount()).append(" seed(s), ").append(torrentFile.leechCount()).append(" leecher(s)
    "); - htmlText.append(String.format("
    Magnet URI
    ", StringEscapeUtils.escapeHtml4(torrentFile.magnetUri()))); - htmlText.append(String.format("
    Download URI
    ", StringEscapeUtils.escapeHtml4(torrentFile.downloadUri()))); + if ((torrentFile.magnetUri() != null) && (torrentFile.magnetUri().length() > 0)) { + htmlText.append(String.format("
    Magnet URI
    ", StringEscapeUtils.escapeHtml4(torrentFile.magnetUri()))); + } + if ((torrentFile.downloadUri() != null) && (torrentFile.downloadUri().length() > 0)) { + htmlText.append(String.format("
    Download URI
    ", StringEscapeUtils.escapeHtml4(torrentFile.downloadUri()))); + } } htmlText.append("\n"); htmlText.append("\n");