mirror of
https://github.com/restic/restic.git
synced 2024-12-23 08:16:36 +00:00
restorer: cleanup unexpected xattrs on windows
This commit is contained in:
parent
9572b7224f
commit
deca7d08ac
1 changed files with 20 additions and 0 deletions
|
@ -155,6 +155,26 @@ func restoreExtendedAttributes(nodeType, path string, eas []fs.ExtendedAttribute
|
||||||
}
|
}
|
||||||
defer closeFileHandle(fileHandle, path) // Replaced inline defer with named function call
|
defer closeFileHandle(fileHandle, path) // Replaced inline defer with named function call
|
||||||
|
|
||||||
|
// clear old unexpected xattrs by setting them to an empty value
|
||||||
|
oldEAs, err := fs.GetFileEA(fileHandle)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, oldEA := range oldEAs {
|
||||||
|
found := false
|
||||||
|
for _, ea := range eas {
|
||||||
|
if strings.EqualFold(ea.Name, oldEA.Name) {
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !found {
|
||||||
|
eas = append(eas, fs.ExtendedAttribute{Name: oldEA.Name, Value: nil})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err = fs.SetFileEA(fileHandle, eas); err != nil {
|
if err = fs.SetFileEA(fileHandle, eas); err != nil {
|
||||||
return errors.Errorf("set EA failed for path %v, with: %v", path, err)
|
return errors.Errorf("set EA failed for path %v, with: %v", path, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue