From: David ‘Bombe’ Roden Date: Thu, 10 Jan 2013 06:09:26 +0000 (+0100) Subject: Treat empty download URI as null. X-Git-Tag: 0.1~38^2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=2989702742c219f12f11be3bc57c96798364d971;p=rhynodge.git Treat empty download URI as null. --- diff --git a/src/main/java/net/pterodactylus/reactor/filters/TorrentSiteFilter.java b/src/main/java/net/pterodactylus/reactor/filters/TorrentSiteFilter.java index 968d671..94e030f 100644 --- a/src/main/java/net/pterodactylus/reactor/filters/TorrentSiteFilter.java +++ b/src/main/java/net/pterodactylus/reactor/filters/TorrentSiteFilter.java @@ -65,12 +65,16 @@ public abstract class TorrentSiteFilter implements Filter { String name = extractName(dataRow); String size = extractSize(dataRow); String magnetUri = extractMagnetUri(dataRow); - String downloadUri; + String downloadUri = extractDownloadUri(dataRow); int fileCount = extractFileCount(dataRow); int seedCount = extractSeedCount(dataRow); int leechCount = extractLeechCount(dataRow); try { - downloadUri = new URI(((HtmlState) state).uri()).resolve(URLEncoder.encode(extractDownloadUri(dataRow), "UTF-8").replace("%2F", "/")).toString(); + if ((downloadUri != null) && (downloadUri.length() > 0)) { + downloadUri = new URI(((HtmlState) state).uri()).resolve(URLEncoder.encode(downloadUri, "UTF-8").replace("%2F", "/")).toString(); + } else { + downloadUri = null; + } TorrentFile torrentFile = new TorrentFile(name, size, magnetUri, downloadUri, fileCount, seedCount, leechCount); torrentState.addTorrentFile(torrentFile); } catch (URISyntaxException use1) {