Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
fix Downloader to support text/* files
Browse files Browse the repository at this point in the history
update session adaptor to support downloading multiple files from incoming messages
  • Loading branch information
iamironrabbit committed Jun 4, 2018
1 parent 2fef352 commit cb62dff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/eu/siacs/conversations/Downloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public boolean get (String urlString, OutputStream storageStream) throws IOExcep
connection.connect();
mMimeType = connection.getContentType();

if (mMimeType != null && (!mMimeType.startsWith("text"))) {
if (mMimeType != null) {
OutputStream os = setupOutputStream(storageStream, url.getRef());
byte[] buffer = new byte[4096];
int count;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1188,10 +1188,11 @@ public boolean onIncomingMessage(ChatSession ses, final org.awesomeapp.messenger

boolean wasMessageSeen = false;
ArrayList<String> mimeTypes = new ArrayList<>();
int attachIdx = 0;

for (String mediaLink : mediaLinks)
{
String resultMimeType = downloadMedia (mediaLink, msg.getID(), nickname);
String resultMimeType = downloadMedia (mediaLink, msg.getID() + "-" + attachIdx++, nickname);
mimeTypes.add(resultMimeType);
}

Expand Down Expand Up @@ -2067,7 +2068,6 @@ public String downloadMedia (String mediaLink, String msgId, String nickname)

insertOrUpdateChat(result);

// Imps.deleteMessageInDb(service.getContentResolver(),msgId);
Uri messageUri = Imps.insertMessageInDb(service.getContentResolver(),
mIsGroupChat, getId(),
true, nickname,
Expand Down

0 comments on commit cb62dff

Please sign in to comment.