Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/keepass2android-app/Utils/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/keepass2android-app/fileselect/FileSelectActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down