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

@@ -4,10 +4,12 @@ import (
"bytes"
"encoding/json"
"errors"
"path/filepath"
_ "fmt"
"io"
"io/ioutil"
"log"
"mime"
"mime/multipart"
"net/http"
)
@@ -29,7 +31,8 @@ func Upload(uploadUrl string, filename string, reader io.Reader) (*UploadResult,
log.Println("error copying data", err)
return nil, err
}
content_type := body_writer.FormDataContentType()
content_type := mime.TypeByExtension(filepath.Ext(filename))
content_type := body_writer.FormDataContentType()
if err = body_writer.Close(); err != nil {
log.Println("error closing body", err)
return nil, err