From 2989702742c219f12f11be3bc57c96798364d971 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 10 Jan 2013 07:09:26 +0100 Subject: [PATCH] Treat empty download URI as null. --- .../java/net/pterodactylus/reactor/filters/TorrentSiteFilter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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) { -- 2.7.4