From f78762fb88dae183f3e2b6d004b06efa419d5b2d Mon Sep 17 00:00:00 2001 From: Jonathan Simon Date: Sat, 6 Jun 2020 14:46:49 -0400 Subject: [PATCH] Remove all whitespace from URL when adding The use case is fairly specific. This allows copying and pasting URLs from a command line session where the URL wraps inside the terminal, which injects whitespace in the middle of the URL. Removing the whitespace manually is tedious. This handles it in the app. Risk: Low --- .../java/org/transdroid/daemon/task/AddByMagnetUrlTask.java | 2 +- app/src/main/java/org/transdroid/daemon/task/AddByUrlTask.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 58a0b26b..a9bb3009 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"); + return extras.getString("URL").replaceAll("\\s", ""); } } diff --git a/app/src/main/java/org/transdroid/daemon/task/AddByUrlTask.java b/app/src/main/java/org/transdroid/daemon/task/AddByUrlTask.java index 6c5e2fbc..cbe94cc6 100644 --- a/app/src/main/java/org/transdroid/daemon/task/AddByUrlTask.java +++ b/app/src/main/java/org/transdroid/daemon/task/AddByUrlTask.java @@ -33,7 +33,7 @@ public class AddByUrlTask extends DaemonTask { return new AddByUrlTask(adapter, data); } public String getUrl() { - return extras.getString("URL"); + return extras.getString("URL").replaceAll("\\s", ""); } public String getTitle() { return extras.getString("TITLE");