fixed downloading of deleted files

This commit is contained in:
Christian Schneppe 2019-01-25 21:22:44 +01:00
parent 001ffba420
commit 3ca7e0c55a
2 changed files with 3 additions and 3 deletions

View file

@ -380,9 +380,9 @@ public class HttpDownloadConnection implements Transferable {
connection.setUseCaches(false);
connection.setRequestProperty("User-Agent", mXmppConnectionService.getIqGenerator().getUserAgent());
connection.setRequestProperty("Accept-Encoding", "identity");
final boolean tryResume = file.exists() && file.getKey() == null && file.getSize() > 0;
final long expected = file.getExpectedSize();
final boolean tryResume = file.exists() && file.getKey() == null && file.getSize() > 0 && file.getSize() < expected;
long resumeSize = 0;
long expected = file.getExpectedSize();
if (tryResume) {
resumeSize = file.getSize();
Log.d(Config.LOGTAG, "http download trying resume after" + resumeSize + " of " + expected);

View file

@ -1670,7 +1670,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
Log.d(Config.LOGTAG, "type: " + transferable.getClass().getName());
Toast.makeText(getActivity(), R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
}
} else if (message.treatAsDownloadable()) {
} else if (message.treatAsDownloadable() || message.hasFileOnRemoteHost()) {
createNewConnection(message);
}
}