1. ensure replicated file has the same timestamp

2. upload can specify modified time by &ts=...
3. correctly return code 304
This commit is contained in:
Chris Lu
2013-07-10 00:25:14 -07:00
parent 53b6831f73
commit 4c200acd7d
5 changed files with 20 additions and 9 deletions

View File

@@ -66,7 +66,12 @@ func upload(filename string, server string, fid string) (int, error) {
debug("Failed to open file:", filename)
return 0, err
}
ret, e := operation.Upload("http://"+server+"/"+fid, path.Base(filename), fh)
fi, fiErr := fh.Stat()
if fiErr!=nil {
debug("Failed to stat file:", filename)
return 0, fiErr
}
ret, e := operation.Upload("http://"+server+"/"+fid+"?ts="+strconv.Itoa(int(fi.ModTime().Unix()) ), path.Base(filename), fh)
if e != nil {
return 0, e
}