camput file: use abspath when uploading file

Change-Id: Ia42f2c09a6c76d2e5f2b80ad309ab3e98fa17c49
This commit is contained in:
mpl 2012-12-20 00:22:29 +01:00
parent c966fe8c12
commit 12ddaab1d5
1 changed files with 6 additions and 2 deletions

View File

@ -435,7 +435,11 @@ func (up *Uploader) uploadNodeRegularFile(n *node) (*client.PutResult, error) {
}
func (up *Uploader) UploadFile(filename string) (respr *client.PutResult, outerr error) {
fi, err := up.lstat(filename)
fullPath, err := filepath.Abs(filename)
if err != nil {
return nil, err
}
fi, err := up.lstat(fullPath)
if err != nil {
return nil, err
}
@ -444,7 +448,7 @@ func (up *Uploader) UploadFile(filename string) (respr *client.PutResult, outerr
panic("must use UploadTree now for directories")
}
n := &node{
fullPath: filename, // TODO(bradfitz): resolve this to an abspath
fullPath: fullPath,
fi: fi,
}
return up.uploadNode(n)