瀏覽代碼

lib/config, lib/model: Make sure to hide our special files (fixes #4382)

The folder marker conversion forgot to hide the .stfolder. This adds
that, for those who have not yet been converted.

Also adds Hide() calls to the folder start, to mend historical
unhidedness. (I'm sure this will upset someone who is manually managing
their .stignores in the other direction...)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4384
Jakob Borg 8 年之前
父節點
當前提交
3ee12464b4
共有 2 個文件被更改,包括 9 次插入1 次删除
  1. 1 0
      lib/config/config.go
  2. 8 1
      lib/model/model.go

+ 1 - 0
lib/config/config.go

@@ -392,6 +392,7 @@ func convertV22V23(cfg *Configuration) {
 			err = fs.Remove(".stfolder")
 			if err == nil {
 				err = fs.Mkdir(".stfolder", permBits)
+				fs.Hide(".stfolder") // ignore error
 			}
 			if err != nil {
 				l.Fatalln("failed to upgrade folder marker:", err)

+ 8 - 1
lib/model/model.go

@@ -253,7 +253,14 @@ func (m *Model) startFolderLocked(folder string) config.FolderType {
 		}
 	}
 
-	p := folderFactory(m, cfg, ver, fs.MtimeFS())
+	ffs := fs.MtimeFS()
+
+	// These are our metadata files, and they should always be hidden.
+	ffs.Hide(".stfolder")
+	ffs.Hide(".stversions")
+	ffs.Hide(".stignore")
+
+	p := folderFactory(m, cfg, ver, ffs)
 	m.folderRunners[folder] = p
 
 	m.warnAboutOverwritingProtectedFiles(folder)