Skip to content

Commit

Permalink
Do not try to get the tmtime for files being uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Mar 13, 2023
1 parent cccefab commit d16b509
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pkg/storage/utils/decomposedfs/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,14 +909,19 @@ func (n *Node) HasPropagation() (propagation bool) {
return false
}

// GetTMTime reads the tmtime from the extended attributes
// GetTMTime reads the tmtime from the extended attributes, falling back to GetMTime()
func (n *Node) GetTMTime() (time.Time, error) {
b, err := n.XattrString(prefixes.TreeMTimeAttr)
if err == nil {
return time.Parse(time.RFC3339Nano, b)
}

// no tmtime, use mtime
return n.GetMTime()
}

// GetMTime reads the mtime from disk
func (n *Node) GetMTime() (time.Time, error) {
fi, err := os.Lstat(n.InternalPath())
if err != nil {
return time.Time{}, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/storage/utils/decomposedfs/upload/processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func CreateNodeForUpload(upload *Upload, initAttrs node.Attributes) (*node.Node,
}

// overwrite technical information
initAttrs.SetInt64(prefixes.TypeAttr, int64(n.Type()))
initAttrs.SetInt64(prefixes.TypeAttr, int64(provider.ResourceType_RESOURCE_TYPE_FILE))
initAttrs.SetString(prefixes.ParentidAttr, n.ParentID)
initAttrs.SetString(prefixes.NameAttr, n.Name)
initAttrs.SetString(prefixes.BlobIDAttr, n.BlobID)
Expand All @@ -304,7 +304,7 @@ func CreateNodeForUpload(upload *Upload, initAttrs node.Attributes) (*node.Node,
}

// add etag to metadata
tmtime, err := n.GetTMTime()
tmtime, err := n.GetMTime()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d16b509

Please sign in to comment.