Browse Source

Accept magnet url's in Add screen.

pull/11/head
Eric Kok 12 years ago
parent
commit
5bfc629bf5
  1. 15
      android/src/org/transdroid/gui/Add.java

15
android/src/org/transdroid/gui/Add.java

@ -94,12 +94,15 @@ public class Add extends Activity { @@ -94,12 +94,15 @@ public class Add extends Activity {
return;
}
// Check URL structure
try {
new URL(urlText); // Nothing is actually done with it; only for parsing
} catch (MalformedURLException e) {
Toast.makeText(this, R.string.no_valid_url, Toast.LENGTH_SHORT).show();
return;
// Magnet scheme is not supported by java.net.URL so instead we consider this to be okay manually
if (urlText != null && !urlText.startsWith("magnet")) {
// Check URL structure
try {
new URL(urlText); // Nothing is actually done with it; only for parsing
} catch (MalformedURLException e) {
Toast.makeText(this, R.string.no_valid_url, Toast.LENGTH_SHORT).show();
return;
}
}
// Create a result for the calling activity

Loading…
Cancel
Save