store: log when upload SHA1 is ok
This commit is contained in:
parent
48ab32f319
commit
4b0f5dca84
@ -88,13 +88,17 @@ func handleHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
log.Print("upload SHA1: ", sha1Hex)
|
log.Print("upload SHA1: ", sha1Hex)
|
||||||
|
|
||||||
reqSHA1 := req.Header.Get("X-Content-SHA1")
|
reqSHA1 := req.Header.Get("X-Content-SHA1")
|
||||||
if reqSHA1 != "" && reqSHA1 != sha1Hex {
|
if reqSHA1 != "" {
|
||||||
|
if reqSHA1 != sha1Hex {
|
||||||
err = fmt.Errorf("upload SHA1 does not match given SHA1: %s", reqSHA1)
|
err = fmt.Errorf("upload SHA1 does not match given SHA1: %s", reqSHA1)
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
w.Write([]byte(err.Error() + "\n"))
|
w.Write([]byte(err.Error() + "\n"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Print("upload SHA1 is as expected")
|
||||||
|
}
|
||||||
|
|
||||||
os.Rename(tmpOut, filePath)
|
os.Rename(tmpOut, filePath)
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filePath+".sha1", []byte(sha1Hex), 0644); err != nil {
|
if err := ioutil.WriteFile(filePath+".sha1", []byte(sha1Hex), 0644); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user