API: Make snapshot length always the same size (#8138)

Fixes #8135

Minor improvement, also we now use Int64 even on 32 bit systems.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
pull/8142/head
Julien Pivotto 4 years ago committed by GitHub
parent 63be30dcee
commit 7558e9d3c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1478,9 +1478,9 @@ func (api *API) snapshot(r *http.Request) apiFuncResult {
var ( var (
snapdir = filepath.Join(api.dbDir, "snapshots") snapdir = filepath.Join(api.dbDir, "snapshots")
name = fmt.Sprintf("%s-%x", name = fmt.Sprintf("%s-%016x",
time.Now().UTC().Format("20060102T150405Z0700"), time.Now().UTC().Format("20060102T150405Z0700"),
rand.Int()) rand.Int63())
dir = filepath.Join(snapdir, name) dir = filepath.Join(snapdir, name)
) )
if err := os.MkdirAll(dir, 0777); err != nil { if err := os.MkdirAll(dir, 0777); err != nil {

Loading…
Cancel
Save