Skip to content

Commit d51ddb9

Browse files
Bypassed Storage Perms Check for External Share
The share intent provides files via content uris with temporary read permissions, so we do not need to obtain storage permissions
1 parent 63f621c commit d51ddb9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/src/main/java/fr/free/nrw/commons/upload/UploadActivity.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,16 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C
314314
// Check if all required permissions are granted
315315
val hasAllPermissions = hasPermission(this, PERMISSIONS_STORAGE)
316316
val hasPartialAccess = hasPartialAccess(this)
317+
318+
// The share intent provides files via content uris with temporary read permissions,
319+
// so we do not need to obtain storage permissions
320+
val intent = intent
321+
val action = intent.action
322+
if (Intent.ACTION_SEND == action || Intent.ACTION_SEND_MULTIPLE == action) {
323+
receiveSharedItems()
324+
return
325+
}
326+
317327
if (hasAllPermissions || hasPartialAccess) {
318328
// All required permissions are granted, so enable UI elements and perform actions
319329
receiveSharedItems()

0 commit comments

Comments
 (0)