Skip to content

Commit 5aa92ea

Browse files
authored
Merge pull request #3275 from PhilippC/bugfix/3066-keyfile-gets-lost
Fix the bug causing to "forget" the keyfile with Sync in background.
2 parents df20f34 + c2795b2 commit 5aa92ea

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/keepass2android-app/fileselect/FileDbHelper.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ public long CreateFile(IOConnectionInfo ioc, string keyFile, bool updateLastUsag
141141
long id = cursor.GetLong(cursor.GetColumnIndexOrThrow(KeyFileId));
142142

143143
var vals = new ContentValues();
144-
vals.Put(KeyFileKeyfile, keyFile);
144+
// Only update the keyfile if explicitly provided. null means "unknown - preserve existing value".
145+
// An empty string "" is used to intentionally clear the keyfile (e.g. when remember_keyfile is off).
146+
if (keyFile != null)
147+
vals.Put(KeyFileKeyfile, keyFile);
145148
if (updateLastUsageTimestamp)
146149
vals.Put(KeyFileUpdated, Java.Lang.JavaSystem.CurrentTimeMillis());
147150

0 commit comments

Comments
 (0)