Fix unix timestamp in file upload

File API gives timestamp in milliseconds, not seconds, so this converts
it correctly.

Ref T609
pull/172/head
Matt Baer 5 years ago
parent aae2f28bb6
commit 2b066997d1
  1. 3
      account_import.go

@ -146,7 +146,8 @@ func handleImport(app *App, u *User, w http.ResponseWriter, r *http.Request) err
if collAlias != "" { if collAlias != "" {
post.Collection = collAlias post.Collection = collAlias
} }
dateTime := time.Unix(fileDates[formFile.Filename], 0) ts := fileDates[formFile.Filename] / 1000 // Get timestamp in seconds, not milliseconds
dateTime := time.Unix(ts, 0)
post.Created = &dateTime post.Created = &dateTime
created := post.Created.Format("2006-01-02T15:04:05Z") created := post.Created.Format("2006-01-02T15:04:05Z")
submittedPost := SubmittedPost{ submittedPost := SubmittedPost{

Loading…
Cancel
Save