Browse Source

Fixes #340 by not crashing (and showing an error message) if a magnet link (url) is incorrectly structured.

pull/406/head
Eric Kok 7 years ago
parent
commit
ade95f6343
  1. 5
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  2. 1
      latest-search.html

5
app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java

@ -1054,6 +1054,11 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
url = URLDecoder.decode(url, "UTF-8"); url = URLDecoder.decode(url, "UTF-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
// Ignore: UTF-8 is always available on Android devices // Ignore: UTF-8 is always available on Android devices
} catch (IllegalArgumentException e) {
// Illegal character or escape sequence; fail task to show error
onCommunicationError(new DaemonTaskFailureResult(AddByMagnetUrlTask.create(currentConnection, url),
new DaemonException(DaemonException.ExceptionType.FileAccessError, "Invalid characters in magnet link")), false);
return;
} }
AddByMagnetUrlTask addByMagnetUrlTask = AddByMagnetUrlTask.create(currentConnection, url); AddByMagnetUrlTask addByMagnetUrlTask = AddByMagnetUrlTask.create(currentConnection, url);

1
latest-search.html

@ -1 +0,0 @@
30|3.7
Loading…
Cancel
Save