if (lengthReceived == receivingModule.getSize()) {
// finished
downloadingModule.close();
String moduleName = String.format("%s-%s.jar", receivingModule.getId(), receivingModule.getVersion());
Path finalPath = PathManager.getInstance().getHomeModPath().normalize().resolve(moduleName);
if (finalPath.normalize().startsWith(PathManager.getInstance().getHomeModPath())) {
if (Files.exists(finalPath)) {
logger.error("File already exists at {}", finalPath);
joinStatus.setErrorMessage("Module download error");
channelHandlerContext.getChannel().close();
return;