Send correct body for HTTP files

When using HTTP upload to send files, take care to transmit only the URL
rather than the entire body, which contains metadata.
This commit is contained in:
Andreas Straub 2015-07-17 19:44:45 +02:00
parent 2045a71262
commit 9c4d55f82c

View file

@ -961,8 +961,14 @@ public class AxolotlService {
@Nullable @Nullable
public XmppAxolotlMessage encrypt(Message message ){ public XmppAxolotlMessage encrypt(Message message ){
final String content;
if (message.hasFileOnRemoteHost()) {
content = message.getFileParams().url.toString();
} else {
content = message.getBody();
}
final XmppAxolotlMessage axolotlMessage = new XmppAxolotlMessage(message.getContact().getJid().toBareJid(), final XmppAxolotlMessage axolotlMessage = new XmppAxolotlMessage(message.getContact().getJid().toBareJid(),
getOwnDeviceId(), message.getBody()); getOwnDeviceId(), content);
if(findSessionsforContact(message.getContact()).isEmpty()) { if(findSessionsforContact(message.getContact()).isEmpty()) {
return null; return null;