Browse Source

Improve error upon encountering corrupt magnet link; fixes #598

pull/603/head
Eric Kok 3 years ago
parent
commit
d20d20012b
  1. 2
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  2. 2
      app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java
  3. 3
      app/src/main/java/org/transdroid/daemon/DaemonException.java
  4. 1
      app/src/main/res/values/strings.xml

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

@ -1002,7 +1002,7 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
// Illegal character or escape sequence; fail task to show error // Illegal character or escape sequence; fail task to show error
onCommunicationError(new DaemonTaskFailureResult(AddByMagnetUrlTask.create(currentConnection, url), onCommunicationError(new DaemonTaskFailureResult(AddByMagnetUrlTask.create(currentConnection, url),
new DaemonException(DaemonException.ExceptionType.FileAccessError, "Invalid characters in magnet link")), false); new DaemonException(DaemonException.ExceptionType.MalformedUri, "Invalid characters in magnet uri")), false);
return; return;
} }

2
app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java

@ -73,6 +73,8 @@ public class LocalTorrent {
return R.string.error_401; return R.string.error_401;
case FileAccessError: case FileAccessError:
return R.string.error_torrentfile; return R.string.error_torrentfile;
case MalformedUri:
return R.string.error_parsinguri;
case ConnectionError: case ConnectionError:
default: default:
return R.string.error_httperror; return R.string.error_httperror;

3
app/src/main/java/org/transdroid/daemon/DaemonException.java

@ -56,7 +56,8 @@ public class DaemonException extends Exception {
ParsingFailed, ParsingFailed,
AuthenticationFailure, AuthenticationFailure,
NotConnected, NotConnected,
FileAccessError FileAccessError,
MalformedUri
} }
} }

1
app/src/main/res/values/strings.xml

@ -476,6 +476,7 @@
<string name="error_daemonnotconnected">Web interface not connected to a running daemon</string> <string name="error_daemonnotconnected">Web interface not connected to a running daemon</string>
<string name="error_401">Access denied (please check your settings)</string> <string name="error_401">Access denied (please check your settings)</string>
<string name="error_torrentfile">Can\'t read .torrent file</string> <string name="error_torrentfile">Can\'t read .torrent file</string>
<string name="error_parsinguri">Link is not a valid uri</string>
<string name="error_parsingrss">Error while parsing the RSS feed</string> <string name="error_parsingrss">Error while parsing the RSS feed</string>
<string name="error_invalid_url_form">This URL is not well-formed</string> <string name="error_invalid_url_form">This URL is not well-formed</string>
<string name="error_invalid_search_url">Your web search URL is invalid:</string> <string name="error_invalid_search_url">Your web search URL is invalid:</string>

Loading…
Cancel
Save