mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-25 10:42:17 -05:00
added checks to ensure existing files are returned. fixes an issue with opening files from gdrive on Android 4.4+ through system file manager
This commit is contained in:
parent
a1e83c1706
commit
7cffa9a3c3
@ -18,6 +18,7 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Database;
|
||||
@ -200,7 +201,9 @@ namespace keepass2android
|
||||
ICursor c1 = ctx.ContentResolver.Query(uri, col, null, null, null);
|
||||
c1.MoveToFirst();
|
||||
|
||||
return c1.GetString(0);
|
||||
var possibleFilename = c1.GetString(0);
|
||||
if (File.Exists(possibleFilename))
|
||||
return possibleFilename;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -209,7 +212,7 @@ namespace keepass2android
|
||||
}
|
||||
|
||||
String filename = data.Data.Path;
|
||||
if (String.IsNullOrEmpty(filename))
|
||||
if ((String.IsNullOrEmpty(filename) || (!File.Exists(filename))))
|
||||
filename = data.DataString;
|
||||
return filename;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user