@@ -1745,14 +1745,6 @@ func copierHandlerPut(bulkReader io.Reader, req request, idMappings *idtools.IDM
1745
1745
if err != nil {
1746
1746
return errors .Wrapf (err , "copier: put: error creating %q" , path )
1747
1747
}
1748
- // restore xattrs
1749
- if ! req .PutOptions .StripXattrs {
1750
- if err = Lsetxattrs (path , hdr .Xattrs ); err != nil { // nolint:staticcheck
1751
- if ! req .PutOptions .IgnoreXattrErrors {
1752
- return errors .Wrapf (err , "copier: put: error setting extended attributes on %q" , path )
1753
- }
1754
- }
1755
- }
1756
1748
// set ownership
1757
1749
if err = lchown (path , hdr .Uid , hdr .Gid ); err != nil {
1758
1750
return errors .Wrapf (err , "copier: put: error setting ownership of %q to %d:%d" , path , hdr .Uid , hdr .Gid )
@@ -1778,6 +1770,14 @@ func copierHandlerPut(bulkReader io.Reader, req request, idMappings *idtools.IDM
1778
1770
return errors .Wrapf (err , "error setting additional permissions on %q to 0%o" , path , mode )
1779
1771
}
1780
1772
}
1773
+ // set xattrs, including some that might have been reset by chown()
1774
+ if ! req .PutOptions .StripXattrs {
1775
+ if err = Lsetxattrs (path , hdr .Xattrs ); err != nil { // nolint:staticcheck
1776
+ if ! req .PutOptions .IgnoreXattrErrors {
1777
+ return errors .Wrapf (err , "copier: put: error setting extended attributes on %q" , path )
1778
+ }
1779
+ }
1780
+ }
1781
1781
// set time
1782
1782
if hdr .AccessTime .IsZero () || hdr .AccessTime .Before (hdr .ModTime ) {
1783
1783
hdr .AccessTime = hdr .ModTime
0 commit comments