From a1c367c0e04e29c47e2a4fc66a745c47981b8fb3 Mon Sep 17 00:00:00 2001 From: Brian Witt Date: Sun, 6 Nov 2022 20:09:32 -0800 Subject: [PATCH] Fix stripping space out of links but keep spaces in name intact --- .../main/java/org/transdroid/core/gui/TorrentsActivity.java | 3 ++- .../java/org/transdroid/daemon/task/AddByMagnetUrlTask.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java b/app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java index ae9b3f1d..d79158d8 100644 --- a/app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java @@ -996,7 +996,8 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE // Since v39 Chrome sends application/x-www-form-urlencoded magnet links and most torrent clients do not understand those, so decode first try { - url = URLDecoder.decode(url, "UTF-8"); + url = URLDecoder.decode(url.replaceAll("\\s", ""), "UTF-8"); + title = URLDecoder.decode(title, "UTF-8"); } catch (UnsupportedEncodingException e) { // Ignore: UTF-8 is always available on Android devices } catch (IllegalArgumentException e) { diff --git a/app/src/main/java/org/transdroid/daemon/task/AddByMagnetUrlTask.java b/app/src/main/java/org/transdroid/daemon/task/AddByMagnetUrlTask.java index a71109a4..7a56d7e7 100644 --- a/app/src/main/java/org/transdroid/daemon/task/AddByMagnetUrlTask.java +++ b/app/src/main/java/org/transdroid/daemon/task/AddByMagnetUrlTask.java @@ -32,6 +32,6 @@ public class AddByMagnetUrlTask extends DaemonTask { return new AddByMagnetUrlTask(adapter, data); } public String getUrl() { - return extras.getString("URL").replaceAll("\\s", ""); + return extras.getString("URL"); } }