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>
This commit is contained in:
Julien Pivotto 2020-11-01 21:07:38 +01:00 committed by GitHub
parent 63be30dcee
commit 7558e9d3c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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 {