fs uploader skip system folders on windows

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2024-11-28 17:10:58 +08:00
parent bc6414672e
commit d2a25cd446
2 changed files with 7 additions and 1 deletions

View File

@@ -138,7 +138,9 @@ func (p *Progress) HashingFile(fname string) {}
func (p *Progress) ExcludedFile(fname string, numBytes int64) {}
// ExcludedDir statistic the dir been excluded currently
func (p *Progress) ExcludedDir(dirname string) {}
func (p *Progress) ExcludedDir(dirname string) {
p.log.Infof("Excluded dir %s", dirname)
}
// FinishedHashingFile which will called when specific file finished hash
func (p *Progress) FinishedHashingFile(fname string, numBytes int64) {

View File

@@ -127,6 +127,10 @@ func setupPolicy(ctx context.Context, rep repo.RepositoryWriter, sourceInfo snap
curPolicy.UploadPolicy.ParallelUploadAboveSize = newOptionalInt64(2 << 30)
}
if runtime.GOOS == "windows" {
curPolicy.FilesPolicy.IgnoreRules = []string{"/System Volume Information/", "/$Recycle.Bin/"}
}
err := setPolicyFunc(ctx, rep, sourceInfo, curPolicy)
if err != nil {
return nil, errors.Wrap(err, "error to set policy")