Fix #1347 Draft file name "Unknown".

getManuallyCalculatedSlideInfo() in AttatchmentManager sometimes failed to get a file name. Now, in this case, it is just extracted from the uri.
This commit is contained in:
Hocuri
2020-05-11 11:37:52 +02:00
parent af0c866c8d
commit da536f1ed9
@@ -60,6 +60,7 @@ import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
import org.thoughtcrime.securesms.util.guava.Optional;
import org.thoughtcrime.securesms.util.views.Stub;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedList;
@@ -352,6 +353,10 @@ public class AttachmentManager {
height = dimens.second;
}
if (fileName == null) {
fileName = new File(uri.getPath()).getName();
}
Log.w(TAG, "local slide with size " + mediaSize + " took " + (System.currentTimeMillis() - start) + "ms");
return mediaType.createSlide(context, uri, fileName, mimeType, mediaSize, width, height);
}