From 2b14af7308f47384d9f9d598c36e290fc61db16c Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Fri, 28 Jun 2013 12:44:55 +0200 Subject: [PATCH] Treat Transmission folder setting as Transmission 2.2's new option rpc-url (effectively replacing the default /transmission folder); see issue 341. --- .../daemon/Transmission/TransmissionAdapter.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/src/org/transdroid/daemon/Transmission/TransmissionAdapter.java b/lib/src/org/transdroid/daemon/Transmission/TransmissionAdapter.java index 5ccc3de4..be9b3b9a 100644 --- a/lib/src/org/transdroid/daemon/Transmission/TransmissionAdapter.java +++ b/lib/src/org/transdroid/daemon/Transmission/TransmissionAdapter.java @@ -461,7 +461,16 @@ public class TransmissionAdapter 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()) + "/transmission/rpc"; + String folder = "/transmission"; + if (settings.getFolder() == null || settings.getFolder().trim().isEmpty()) { + // Allow the user's folder setting to override /transmission (as per Transmission's rpc-url option) + 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 + + "/rpc"; } private ArrayList parseJsonRetrieveTorrents(JSONObject response) throws JSONException {