Browse Source

Accept magnet url's in Add screen.

pull/11/head
Eric Kok 13 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 {
return; return;
} }
// Check URL structure // Magnet scheme is not supported by java.net.URL so instead we consider this to be okay manually
try { if (urlText != null && !urlText.startsWith("magnet")) {
new URL(urlText); // Nothing is actually done with it; only for parsing // Check URL structure
} catch (MalformedURLException e) { try {
Toast.makeText(this, R.string.no_valid_url, Toast.LENGTH_SHORT).show(); new URL(urlText); // Nothing is actually done with it; only for parsing
return; } catch (MalformedURLException e) {
Toast.makeText(this, R.string.no_valid_url, Toast.LENGTH_SHORT).show();
return;
}
} }
// Create a result for the calling activity // Create a result for the calling activity

Loading…
Cancel
Save