From: David ‘Bombe’ Roden Date: Sat, 6 Nov 2021 20:52:54 +0000 (+0100) Subject: 🐛 Fix filename comparison X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=337460f355a3e652b760a057fe4ddd8e6847c905;p=xudocci.git 🐛 Fix filename comparison 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. --- 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; }