Browse Source

Fix Deluge magnet support -- Deluge doesn't support application/x-www-form-urlencoded magnet links any more, like send from Chrome. Fixes #168, fixes #169.

pull/173/head
Eric Kok 10 years ago
parent
commit
6b5551ae77
  1. 2
      lib/src/org/transdroid/daemon/Aria2c/Aria2Adapter.java
  2. 3
      lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java

2
lib/src/org/transdroid/daemon/Aria2c/Aria2Adapter.java

@ -341,6 +341,8 @@ public class Aria2Adapter implements IDaemonAdapter { @@ -341,6 +341,8 @@ public class Aria2Adapter implements IDaemonAdapter {
JSONArray files = tor.getJSONArray("files");
if (files.length() > 0) {
name = Uri.parse(files.getJSONObject(0).getString("path")).getLastPathSegment();
if (name == null)
name = files.getJSONObject(0).getString("path");
}
}
if (name == null)

3
lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java

@ -22,6 +22,7 @@ import java.io.FileNotFoundException; @@ -22,6 +22,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -276,6 +277,8 @@ public class DelugeAdapter implements IDaemonAdapter { @@ -276,6 +277,8 @@ public class DelugeAdapter implements IDaemonAdapter {
// Request to add a magnet link by URL
String magnet = ((AddByMagnetUrlTask)task).getUrl();
// Deluge doesn't support (fully) application/x-www-form-urlencoded magnet links
magnet = URLDecoder.decode(magnet, "UTF-8");
params.put(magnet);
params.put(new JSONArray());

Loading…
Cancel
Save