mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Fix banned mime type errors in DefaultContentScannerService (#7255)
The content scanner allows disabling certain mime types for files in the set up HS, but it turns out for the scan operation instead of returning an `"is_valid": false` result in that case, it returns an error with a `MCS_MIME_TYPE_FORBIDDEN` reason. We need to handle that case as if it had returned the false `isValid` value.
This commit is contained in:
committed by
GitHub
parent
05917bd65f
commit
18034e02a2
+4
@@ -7,9 +7,11 @@
|
||||
|
||||
package io.element.android.libraries.matrix.impl.scanner
|
||||
|
||||
import io.element.android.libraries.core.extensions.mapFailure
|
||||
import io.element.android.libraries.core.extensions.runCatchingExceptions
|
||||
import io.element.android.libraries.matrix.api.media.MediaSource
|
||||
import io.element.android.libraries.matrix.api.scanner.ContentScanner
|
||||
import io.element.android.libraries.matrix.impl.exception.mapClientException
|
||||
import org.matrix.rustcomponents.sdk.Client
|
||||
import org.matrix.rustcomponents.sdk.NoHandle
|
||||
import org.matrix.rustcomponents.sdk.ContentScanner as RustScanner
|
||||
@@ -22,6 +24,8 @@ class RustContentScanner(
|
||||
override suspend fun scan(mediaSource: MediaSource): Result<Boolean> {
|
||||
return runCatchingExceptions {
|
||||
rustScanner.scan(client, mediaSource.toRustMediaSource()).clean
|
||||
}.mapFailure {
|
||||
it.mapClientException()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user