Browse Source

refactoring

pull/1255/head
Chris Lu 5 years ago
parent
commit
e1911760a7
  1. 4
      weed/filesys/fscache.go
  2. 1
      weed/operation/upload_content.go

4
weed/filesys/fscache.go

@ -99,7 +99,6 @@ func (c *FsCache) Move(oldPath util.FullPath, newPath util.FullPath) *FsNode {
if f.entry != nil { if f.entry != nil {
f.entry.Name = f.Name f.entry.Name = f.Name
} }
f.dir = target.parent.node.(*Dir)
} }
parent.disconnectChild(target) parent.disconnectChild(target)
@ -119,6 +118,9 @@ func (n *FsNode) connectToParent(parent *FsNode) {
if dir, ok := n.node.(*Dir); ok { if dir, ok := n.node.(*Dir); ok {
dir.parent = parent.node.(*Dir) dir.parent = parent.node.(*Dir)
} }
if f, ok := n.node.(*File); ok {
f.dir = parent.node.(*Dir)
}
n.childrenLock.Lock() n.childrenLock.Lock()
parent.children[n.name] = n parent.children[n.name] = n
n.childrenLock.Unlock() n.childrenLock.Unlock()

1
weed/operation/upload_content.go

@ -80,7 +80,6 @@ func doUploadData(uploadUrl string, filename string, cipher bool, data []byte, i
if !isInputGzipped { if !isInputGzipped {
if shouldBeZipped, iAmSure := util.IsGzippableFileType(filepath.Base(filename), mtype); iAmSure && shouldBeZipped { if shouldBeZipped, iAmSure := util.IsGzippableFileType(filepath.Base(filename), mtype); iAmSure && shouldBeZipped {
shouldGzipNow = true shouldGzipNow = true
contentIsGzipped = true
} else if len(data) > 128 { } else if len(data) > 128 {
var compressed []byte var compressed []byte
compressed, err = util.GzipData(data[0:128]) compressed, err = util.GzipData(data[0:128])

Loading…
Cancel
Save