Fix unix timestamp in file upload

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

Ref T609
This commit is contained in:
Matt Baer 2020-01-14 12:21:11 -05:00
parent aae2f28bb6
commit 2b066997d1
1 changed files with 2 additions and 1 deletions

View File

@ -146,7 +146,8 @@ func handleImport(app *App, u *User, w http.ResponseWriter, r *http.Request) err
if 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
created := post.Created.Format("2006-01-02T15:04:05Z")
submittedPost := SubmittedPost{