diff --git a/src/keepass2android-app/Utils/Util.cs b/src/keepass2android-app/Utils/Util.cs index 897f13bc7..fefc1ad16 100644 --- a/src/keepass2android-app/Utils/Util.cs +++ b/src/keepass2android-app/Utils/Util.cs @@ -539,7 +539,9 @@ public static string IntentToFilename(Intent data, Context ctx) c1.MoveToFirst(); var possibleFilename = c1.GetString(0); - if (File.Exists(possibleFilename)) + //the path only if it may be written: on Android 11+ a file of the shared storage is readable by its path but not + //writable (pickers like the one of HyperOS give the path too), while the content uri itself grants writing + if (File.Exists(possibleFilename) && new Java.IO.File(possibleFilename).CanWrite()) return possibleFilename; } } diff --git a/src/keepass2android-app/fileselect/FileSelectActivity.cs b/src/keepass2android-app/fileselect/FileSelectActivity.cs index ea8138ce4..7b395b557 100644 --- a/src/keepass2android-app/fileselect/FileSelectActivity.cs +++ b/src/keepass2android-app/fileselect/FileSelectActivity.cs @@ -422,7 +422,7 @@ protected override void OnActivityResult(int requestCode, Result resultCode, Int if ((resultCode == Result.Ok) && (requestCode == RequestCodeEditIoc)) { - string filename = Util.IntentToFilename(data, this); + string filename = Util.IntentToFilename(data, this) ?? data.DataString; LaunchPasswordActivityForIoc(IOConnectionInfo.FromPath(filename)); }