From 3ffbdbb19bec4e2a80febc7dd118a58d2f513cd7 Mon Sep 17 00:00:00 2001 From: Laurent Clouet Date: Sat, 29 May 2021 16:40:21 +0200 Subject: [PATCH] Fix: do not show download progress if there is not content length --- src/com/sheepit/client/Client.java | 2 +- src/com/sheepit/client/Server.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/sheepit/client/Client.java b/src/com/sheepit/client/Client.java index dcc1a74..9f69047 100644 --- a/src/com/sheepit/client/Client.java +++ b/src/com/sheepit/client/Client.java @@ -864,7 +864,7 @@ import lombok.Data; } } - this.gui.status(String.format("Downloading %s", download_type), 0, 0); + this.gui.status(String.format("Downloading %s", download_type)); // must download the archive Error.Type ret = this.server.HTTPGetFile(url, local_path, this.gui, update_ui); diff --git a/src/com/sheepit/client/Server.java b/src/com/sheepit/client/Server.java index f376935..f0fb46c 100644 --- a/src/com/sheepit/client/Server.java +++ b/src/com/sheepit/client/Server.java @@ -436,7 +436,9 @@ public class Server extends Thread { written += len; if ((written - lastUpd) > 1000000) { // only update the gui every 1MB - gui_.status(status_, (int) (100.0 * written / size), written); + if (size != -1) { // no header for contentlength + gui_.status(status_, (int) (100.0 * written / size), written); + } lastUpd = written; } }