Skip to content

Commit

Permalink
Merge pull request #1 from owncloud/revert-calculated-etag-but-keep-t…
Browse files Browse the repository at this point in the history
…ree-size

revert calculated etag, keep tree size
  • Loading branch information
butonic authored Apr 10, 2019
2 parents 2cc9c76 + d9eb53d commit bd045ac
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions pkg/storage/fs/eos/eos.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package eos

import (
"context"
"crypto/md5"
"encoding/binary"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -540,17 +538,10 @@ func (fs *eosStorage) convertToMD(ctx context.Context, eosFileInfo *eosclient.Fi
finfo.Path = fs.removeNamespace(ctx, eosFileInfo.File)
finfo.Mtime = eosFileInfo.MTime
finfo.IsDir = eosFileInfo.IsDir
// FIXME the etag of dirs does not change, only mtime and size are propagated, so we have to calculate an etag for dirs
finfo.Etag = eosFileInfo.ETag
if eosFileInfo.IsDir {
h := md5.New()
binary.Write(h, binary.LittleEndian, eosFileInfo.MTime)
binary.Write(h, binary.LittleEndian, eosFileInfo.Inode)
io.WriteString(h, eosFileInfo.Instance)
binary.Write(h, binary.LittleEndian, eosFileInfo.TreeSize)
finfo.Etag = fmt.Sprintf(`"%x"`, h.Sum(nil))
finfo.Size = eosFileInfo.TreeSize
} else {
finfo.Etag = eosFileInfo.ETag
finfo.Size = eosFileInfo.Size
}
finfo.Mime = mime.Detect(finfo.IsDir, finfo.Path)
Expand Down

0 comments on commit bd045ac

Please sign in to comment.