Skip to content

Commit

Permalink
Merge pull request #288 from tbs60/dev_tming
Browse files Browse the repository at this point in the history
Dev tming
  • Loading branch information
tming authored Aug 27, 2024
2 parents 2c91bef + 122f30c commit fe53dc5
Showing 1 changed file with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -837,28 +837,36 @@ func encodeSendFileReq(
}

fullpath := sandbox.GetAbsPath(f.FilePath)
size := f.FileSize
md5 := f.Md5
targetrelativepath := f.Targetrelativepath
filemode := f.Filemode
linkTarget := f.LinkTarget
modifytime := f.Lastmodifytime

// TODO : fresh file info here, avoid file info changed
newlyInfo := dcFile.Lstat(fullpath)
if !newlyInfo.Exist() {
blog.Warnf("file %f not existed when encode send request", fullpath)
continue
}
if size > 0 {
var newlyInfo *dcFile.Info
localdir := filepath.Dir(fullpath)
// 如果本地路径和远端不一样,则不能用Lstat
if localdir != targetrelativepath {
newlyInfo = dcFile.Stat(fullpath)
} else {
newlyInfo = dcFile.Lstat(fullpath)
}
if !newlyInfo.Exist() {
blog.Warnf("file %f not existed when encode send request", fullpath)
continue
}

size := newlyInfo.Size()
md5 := ""
if f.Md5 != "" {
md5, _ = newlyInfo.Md5()
size = newlyInfo.Size()
md5 = ""
if f.Md5 != "" {
md5, _ = newlyInfo.Md5()
}
filemode = newlyInfo.Mode32()
modifytime = newlyInfo.ModifyTime64()
}
filemode := newlyInfo.Mode32()
modifytime := newlyInfo.ModifyTime64()

// size := f.FileSize
// md5 := f.Md5
targetrelativepath := f.Targetrelativepath
// filemode := f.Filemode
linkTarget := f.LinkTarget
// modifytime := f.Lastmodifytime

if size <= 0 {
pbbody.Inputfiles = append(pbbody.Inputfiles, &protocol.PBFileDesc{
Expand Down

0 comments on commit fe53dc5

Please sign in to comment.