lib/db, lib/model: Allow needing invalid files (fixes #7474) (#7476)

This commit is contained in:
Simon Frei
2021-03-15 07:58:01 +01:00
committed by GitHub
parent bb886868d2
commit 273ee09925
8 changed files with 125 additions and 46 deletions
+16 -12
View File
@@ -178,18 +178,7 @@ func (s *indexSender) sendIndexTo(ctx context.Context) error {
return true
}
// Mark the file as invalid if any of the local bad stuff flags are set.
f.RawInvalid = f.IsInvalid()
// If the file is marked LocalReceive (i.e., changed locally on a
// receive only folder) we do not want it to ever become the
// globally best version, invalid or not.
if f.IsReceiveOnlyChanged() {
f.Version = protocol.Vector{}
}
// never sent externally
f.LocalFlags = 0
f.VersionHash = nil
f = prepareFileInfoForIndex(f)
previousWasDelete = f.IsDeleted()
@@ -211,6 +200,21 @@ func (s *indexSender) sendIndexTo(ctx context.Context) error {
return err
}
func prepareFileInfoForIndex(f protocol.FileInfo) protocol.FileInfo {
// Mark the file as invalid if any of the local bad stuff flags are set.
f.RawInvalid = f.IsInvalid()
// If the file is marked LocalReceive (i.e., changed locally on a
// receive only folder) we do not want it to ever become the
// globally best version, invalid or not.
if f.IsReceiveOnlyChanged() {
f.Version = protocol.Vector{}
}
// never sent externally
f.LocalFlags = 0
f.VersionHash = nil
return f
}
func (s *indexSender) String() string {
return fmt.Sprintf("indexSender@%p for %s to %s at %s", s, s.folder, s.conn.ID(), s.conn)
}