From 8967c1798161e620f1b540dee0ed08213cc4567d Mon Sep 17 00:00:00 2001 From: Elouan Martinet Date: Sun, 7 Mar 2021 20:39:57 +0100 Subject: [PATCH] Remove trailing slash from folder in deluge adapter --- .../daemon/adapters/deluge/DelugeAdapter.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeAdapter.java b/app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeAdapter.java index 22f1fe34..d32bc984 100644 --- a/app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeAdapter.java +++ b/app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeAdapter.java @@ -595,8 +595,15 @@ public class DelugeAdapter implements IDaemonAdapter { * @return The URL of the RPC API */ private String buildWebUIUrl() { - return (settings.getSsl() ? "https://" : "http://") + settings.getAddress() + ":" + settings.getPort() + (settings.getFolder() == null ? "" - : settings.getFolder()); + String folder = ""; + if (settings.getFolder() != null) { + folder = settings.getFolder().trim(); + // Strip any trailing slashes + if (folder.endsWith("/")) { + folder = folder.substring(0, folder.length() - 1); + } + } + return (settings.getSsl() ? "https://" : "http://") + settings.getAddress() + ":" + settings.getPort() + folder; } private ArrayList parseJsonRetrieveTorrents(JSONObject response) throws JSONException, DaemonException {