I often (i.e. 3 times out of 4) end up with the remote database being entirely deleted when using sync over a WebDAV connection. The Save function simply doesn't create anything. This isn't KeePass' fault as such, more likely down to the innumerable proxies and firewalls between me and the server.
Problem: In FileTransactionEx.cs function CommitWriteTransaction, it deletes an existing file if it exists. However, it doesn't check that the file it intends to rename exists. Suggest adding a simple test on line 99 which will at least leave the original file intact:
=======
if (!IOConnection.FileExists(m_iocTemp))
{
Debug.Assert(false);
return;
}
if\(IOConnection.FileExists\(m\_iocBase\)\) \{
Second, it seems that a simple delay is enough to make the file write to the WebDAV provider correctly. I don't like this answer, but I also don't have time to properly fault-find :( The delay must come *before* the CommonCleanUpWrite call. Specifically, before the "hashedStream.Close()" call in CommonWriteCleanup; having it between here and the subsequent sSaveTo.Close() doesn't work.
In Kdb4File.Write.cs, function Save, suggest adding something more elegant than this to the "finally" clause:
========
finally {
if (saving to web) { System.Threading.Thread.Sleep(1000); }
CommonCleanUpWrite(sSaveTo, hashedStream);
}
========
Cheers,
Jim