store: log when upload SHA1 is ok
This commit is contained in:
		| @ -88,11 +88,15 @@ 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 != "" { | ||||||
| 			err = fmt.Errorf("upload SHA1 does not match given SHA1: %s", reqSHA1) | 			if reqSHA1 != sha1Hex { | ||||||
| 			w.WriteHeader(http.StatusBadRequest) | 				err = fmt.Errorf("upload SHA1 does not match given SHA1: %s", reqSHA1) | ||||||
| 			w.Write([]byte(err.Error() + "\n")) | 				w.WriteHeader(http.StatusBadRequest) | ||||||
| 			return | 				w.Write([]byte(err.Error() + "\n")) | ||||||
|  | 				return | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			log.Print("upload SHA1 is as expected") | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		os.Rename(tmpOut, filePath) | 		os.Rename(tmpOut, filePath) | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user