Fix file not being sent (2)
This commit is contained in:
parent
5f0d2ea7b1
commit
03f6e63b69
2 changed files with 2 additions and 7 deletions
|
@ -248,13 +248,7 @@ public class DatabaseController {
|
||||||
// Handle messages containing a file
|
// Handle messages containing a file
|
||||||
String filePath = "NULL";
|
String filePath = "NULL";
|
||||||
if (message instanceof FileMessage) {
|
if (message instanceof FileMessage) {
|
||||||
try {
|
filePath = "'" + ((FileMessage) message).getPath() + "'";
|
||||||
filePath = "'" + ((FileMessage) message).storeFile() + "'";
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(getClass().getSimpleName(), "Error while saving the file", e);
|
|
||||||
errorCallback.onError(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String recipientId = message.getRecipient().id;
|
String recipientId = message.getRecipient().id;
|
||||||
|
|
|
@ -66,6 +66,7 @@ public class PeerUser extends User implements Comparable<PeerUser> {
|
||||||
"Sending file message to " + this.getUsername() + " / " + this.getId() + ": " + msg);
|
"Sending file message to " + this.getUsername() + " / " + this.getId() + ": " + msg);
|
||||||
try {
|
try {
|
||||||
final FileMessage message = new FileMessage(CurrentUser.getInstance(), this, new Date(), msg, file.getPath());
|
final FileMessage message = new FileMessage(CurrentUser.getInstance(), this, new Date(), msg, file.getPath());
|
||||||
|
message.storeFile();
|
||||||
connection.send(message, () -> history.addMessage(message, errorCallback), errorCallback);
|
connection.send(message, () -> history.addMessage(message, errorCallback), errorCallback);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(this.getClass().getSimpleName(), "Could not send message: error while opening file", e);
|
Log.e(this.getClass().getSimpleName(), "Could not send message: error while opening file", e);
|
||||||
|
|
Loading…
Reference in a new issue