ldbGenericReplace: correctly handle files with same version but different flags.

This fixes syncthing bug #819.
This commit is contained in:
Jochen Voss 2014-10-09 19:36:31 +01:00 committed by Jochen Voss (voss@sushi)
parent 1bc1c0b14f
commit 481b2186cb

View File

@ -232,7 +232,8 @@ func ldbGenericReplace(db *leveldb.DB, folder, device []byte, fs []protocol.File
// marked a file as invalid, so handle that too.
var ef protocol.FileInfoTruncated
ef.UnmarshalXDR(dbi.Value())
if fs[fsi].Version > ef.Version || fs[fsi].Version != ef.Version {
if fs[fsi].Version > ef.Version ||
(fs[fsi].Version == ef.Version && fs[fsi].Flags != ef.Flags) {
if lv := ldbInsert(batch, folder, device, newName, fs[fsi]); lv > maxLocalVer {
maxLocalVer = lv
}