mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Add fix for m4a mapping to audio/mpeg.
This commit is contained in:
@@ -48,7 +48,9 @@ class ShareRepository(context: Context) {
|
||||
}
|
||||
|
||||
val uri = multiShareExternal.uri
|
||||
val mimeType = getMimeType(appContext, uri, multiShareExternal.mimeType)
|
||||
val size = getSize(appContext, uri)
|
||||
val name = getFileName(appContext, uri)
|
||||
val mimeType = getMimeType(appContext, uri, multiShareExternal.mimeType, name?.substringAfterLast('.', ""))
|
||||
|
||||
val stream: InputStream = try {
|
||||
appContext.contentResolver.openInputStream(uri)
|
||||
@@ -57,9 +59,6 @@ class ShareRepository(context: Context) {
|
||||
null
|
||||
} ?: return ResolvedShareData.Failure
|
||||
|
||||
val size = getSize(appContext, uri)
|
||||
val name = getFileName(appContext, uri)
|
||||
|
||||
val blobUri: Uri = try {
|
||||
BlobProvider.getInstance()
|
||||
.forData(stream, size)
|
||||
@@ -142,8 +141,8 @@ class ShareRepository(context: Context) {
|
||||
companion object {
|
||||
private val TAG = Log.tag(ShareRepository::class.java)
|
||||
|
||||
private fun getMimeType(context: Context, uri: Uri, mimeType: String?): String {
|
||||
var updatedMimeType = MediaUtil.getMimeType(context, uri)
|
||||
private fun getMimeType(context: Context, uri: Uri, mimeType: String?, fileExtension: String? = null): String {
|
||||
var updatedMimeType = MediaUtil.getMimeType(context, uri, fileExtension)
|
||||
if (updatedMimeType == null) {
|
||||
updatedMimeType = MediaUtil.getCorrectedMimeType(mimeType)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user