Skip to content

Commit

Permalink
Add getExternalFilesDir when checking if a path requires a permission
Browse files Browse the repository at this point in the history
  • Loading branch information
javaherisaber committed Sep 6, 2022
1 parent b491ae8 commit f768379
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ private boolean pathRequiresPermission() {
try {
String appDirCanonicalPath = new File(context.getApplicationInfo().dataDir).getCanonicalPath();
String fileCanonicalPath = new File(filePath).getCanonicalPath();
return !fileCanonicalPath.startsWith(appDirCanonicalPath);
String extCanonicalPath = context.getExternalFilesDir(null).getCanonicalPath();
return !(fileCanonicalPath.startsWith(appDirCanonicalPath) || fileCanonicalPath.startsWith(extCanonicalPath));
} catch (IOException e) {
e.printStackTrace();
return true;
Expand Down

0 comments on commit f768379

Please sign in to comment.