lib/model: Don't mark globally deleted items as recv-only (fixes #6910) (#6911)

This commit is contained in:
Simon Frei 2020-08-21 12:34:22 +02:00 committed by GitHub
parent b628460930
commit a65b46debd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -484,10 +484,11 @@ func (f *folder) scanSubdirs(subDirs []string) error {
// What we have locally is equivalent to the global file.
fi.Version = fi.Version.Merge(gf.Version)
fallthrough
case fi.IsDeleted() && gf.IsReceiveOnlyChanged():
case fi.IsDeleted() && (gf.IsReceiveOnlyChanged() || gf.IsDeleted()):
// Our item is deleted and the global item is our own
// receive only file. We can't delete file infos, so
// we just pretend it is a normal deleted file (nobody
// receive only file or deleted too. In the former
// case we can't delete file infos, so we just
// pretend it is a normal deleted file (nobody
// cares about that).
fi.LocalFlags &^= protocol.FlagLocalReceiveOnly
}
@ -624,10 +625,6 @@ func (f *folder) scanSubdirs(subDirs []string) error {
// sure the file gets in sync on the following pull.
nf.Version = protocol.Vector{}
}
// Check for deleted, locally changed items that noone else has.
if f.localFlags&protocol.FlagLocalReceiveOnly != 0 && len(snap.Availability(file.Name)) == 0 {
file.LocalFlags &^= protocol.FlagLocalReceiveOnly
}
l.Debugln("marking file as deleted", nf)
batchAppend(nf, snap)
changes++