From 29286e159b5e74257e1be4da9121f87e831c2d0e Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 12 Dec 2020 00:55:42 +0100 Subject: [PATCH] up2k-client: ignore rejected dupes --- copyparty/web/up2k.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 09ea8b03..9be7c7b0 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -667,12 +667,26 @@ function up2k_init(have_crypto) { } tasker(); } - else + else { + var err = ""; + var rsp = (xhr.responseText + ''); + if (rsp.indexOf('partial upload exists') !== -1) { + err = rsp.slice(5); + } + if (err != "") { + ebi('f{0}t'.format(t.n)).innerHTML = "ERROR"; + ebi('f{0}p'.format(t.n)).innerHTML = err; + + st.busy.handshake.splice(st.busy.handshake.indexOf(t), 1); + tasker(); + return; + } alert("server broke (error {0}):\n\"{1}\"\n".format( xhr.status, (xhr.response && xhr.response.err) || (xhr.responseText && xhr.responseText) || "no further information")); + } }; xhr.open('POST', post_url + 'handshake.php', true); xhr.responseType = 'text';