From 89770f0de2cebfa64ccfe3a1b5bb3429a621a41f Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 20 Feb 2024 15:47:38 +0100 Subject: [PATCH] Fix tests Signed-off-by: alperozturk --- .../java/com/owncloud/android/ui/helpers/UriUploaderIT.kt | 6 ++++++ .../java/com/owncloud/android/ui/helpers/UriUploader.kt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/androidTest/java/com/owncloud/android/ui/helpers/UriUploaderIT.kt b/app/src/androidTest/java/com/owncloud/android/ui/helpers/UriUploaderIT.kt index 7354879b67..543acfb68e 100644 --- a/app/src/androidTest/java/com/owncloud/android/ui/helpers/UriUploaderIT.kt +++ b/app/src/androidTest/java/com/owncloud/android/ui/helpers/UriUploaderIT.kt @@ -5,11 +5,14 @@ import androidx.test.core.app.launchActivity import com.nextcloud.client.jobs.upload.FileUploadWorker import com.nextcloud.test.TestActivity import com.owncloud.android.AbstractIT +import com.owncloud.android.lib.common.utils.Log_OC import org.junit.Assert import org.junit.Test class UriUploaderIT : AbstractIT() { + private val tag = "UriUploaderIT" + @Test fun testUploadPrivatePathSharedPreferences() { launchActivity().use { scenario -> @@ -43,6 +46,9 @@ class UriUploaderIT : AbstractIT() { null ) val uploadResult = sut.uploadUris() + + Log_OC.d(tag, "Upload Result: ${uploadResult.name}") + Assert.assertEquals( "Wrong result code", UriUploader.UriUploaderResultCode.ERROR_SENSITIVE_PATH, diff --git a/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt b/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt index fe723ed244..6f3b147e55 100644 --- a/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt +++ b/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt @@ -115,7 +115,7 @@ class UriUploader( private fun belongsToCurrentApplication(ctx: Context, uri: Uri): Boolean { val authority: String = uri.authority.toString() - val info: ProviderInfo = ctx.packageManager.resolveContentProvider(authority, 0) ?: return false + val info: ProviderInfo = ctx.packageManager.resolveContentProvider(authority, 0) ?: return true return ctx.packageName.equals(info.packageName) }