From daf144af61d0af2d00bce4b5ed50a6295365d1f7 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 15 Jul 2026 21:21:32 +0000 Subject: [PATCH] up2k: fix dragdrop datatransfer type detection; `text/uri-list` observed before `Files` once on wayland dolphin Co-authored-by: Til Schmitter --- copyparty/web/up2k.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 1d8bb5f2..6a7b0441 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -1069,25 +1069,28 @@ function up2k_init(subtle) { return onovercmn(this, e, true); } function onovercmn(self, e, btn) { + var ok = false; try { - var ok = false, dt = e.dataTransfer.types; - for (var a = 0; a < dt.length; a++) + var dt = e.dataTransfer.types; + + for (var a = 0; a < dt.length && !ok; a++) if (dt[a] == 'Files') ok = true; - else if (dt[a] == 'text/uri-list') { - if (btn) { + + for (var a = 0; a < dt.length && !ok; a++) + if (dt[a] == 'text/uri-list') { + if (btn) ok = true; - if (toast.txt == L.u_uri) - toast.hide(); - } else return toast.inf(10, L.u_uri) || true; } - if (!ok) - return true; + if (toast.txt == L.u_uri && ok) + toast.hide(); } catch (ex) { } + if (!ok) + return true; ev(e); try {