Skip to content

Commit 5d50a85

Browse files
fixes: termux#3565 - remove canRead check for scoped storage compat
1 parent f202c93 commit 5d50a85

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

app/src/main/java/com/termux/app/TermuxOpenReceiver.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ public void onReceive(Context context, Intent intent) {
8181
}
8282

8383
final File fileToShare = new File(filePath);
84-
if (!(fileToShare.isFile() && fileToShare.canRead())) {
85-
Logger.logError(LOG_TAG, "Not a readable file: '" + fileToShare.getAbsolutePath() + "'");
84+
if (!fileToShare.isFile()) {
85+
Logger.logError(LOG_TAG, "Not a file: '" + fileToShare.getAbsolutePath() + "'");
8686
return;
8787
}
88+
// Note: canRead() may return false on Android 12+ due to scoped storage,
89+
// but the ContentProvider can still serve the file to other apps. (#3565)
8890

8991
Intent sendIntent = new Intent();
9092
sendIntent.setAction(intentAction);

0 commit comments

Comments
 (0)