Browse Source

Remove trailing slash from folder in deluge adapter

pull/585/head
Elouan Martinet 4 years ago
parent
commit
8967c17981
  1. 11
      app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeAdapter.java

11
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 * @return The URL of the RPC API
*/ */
private String buildWebUIUrl() { private String buildWebUIUrl() {
return (settings.getSsl() ? "https://" : "http://") + settings.getAddress() + ":" + settings.getPort() + (settings.getFolder() == null ? "" String folder = "";
: settings.getFolder()); 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<Torrent> parseJsonRetrieveTorrents(JSONObject response) throws JSONException, DaemonException { private ArrayList<Torrent> parseJsonRetrieveTorrents(JSONObject response) throws JSONException, DaemonException {

Loading…
Cancel
Save