From 337460f355a3e652b760a057fe4ddd8e6847c905 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 6 Nov 2021 21:52:54 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=90=9B=20Fix=20filename=20comparison?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The filename from the Download object is only set later in the download process. I think I should revisit some of the logic of the whole download process, and maybe even some of the data structures. I’m not sure they are still as appropriate as I deemed them to be back then. --- src/main/java/net/pterodactylus/xdcc/core/Core.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 8ef074c..c9c0218 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -39,6 +39,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; import java.util.TreeMap; import java.util.concurrent.TimeUnit; @@ -907,7 +908,7 @@ public class Core extends AbstractExecutionThreadService { eventBus.post(new GenericMessage("c")); /* check if it’s already downloading. */ - if (downloads.values().stream().anyMatch(download -> download.filename().equals(dccSendReceived.filename()) && download.dccReceiver() != null)) { + if (downloads.values().stream().anyMatch(download -> Objects.equals(download.filename(), dccSendReceived.filename()) && download.dccReceiver() != null)) { eventBus.post(new GenericMessage(format("Ignoring offer for %s, it’s already being downloaded.", dccSendReceived.filename()))); return; } -- 2.7.4