diff --git a/filehandlers/imgs/img.go b/filehandlers/imgs/img.go index 9799461b..a182d6ef 100644 --- a/filehandlers/imgs/img.go +++ b/filehandlers/imgs/img.go @@ -200,7 +200,9 @@ func (h *UploadImgHandler) writeImg(s ssh.Session, data *PostMetaData) error { } h.Cfg.Logger.Infof("(%s) found, updating record", data.Filename) - now := time.Now() + + modTime := time.Unix(data.Mtime, 0) + updatePost := db.Post{ ID: data.Cur.ID, @@ -213,7 +215,7 @@ func (h *UploadImgHandler) writeImg(s ssh.Session, data *PostMetaData) error { Text: data.Text, Title: data.Title, Hidden: data.Hidden, - UpdatedAt: &now, + UpdatedAt: &modTime, } _, err = h.DBPool.UpdatePost(&updatePost) if err != nil { diff --git a/filehandlers/post_handler.go b/filehandlers/post_handler.go index 21139206..241ffdbd 100644 --- a/filehandlers/post_handler.go +++ b/filehandlers/post_handler.go @@ -302,7 +302,9 @@ func (h *ScpUploadHandler) Write(s ssh.Session, entry *utils.FileEntry) (string, } logger.Infof("(%s) found, updating record", filename) - now := time.Now() + + modTime := time.Unix(entry.Mtime, 0) + updatePost := db.Post{ ID: post.ID, @@ -315,7 +317,7 @@ func (h *ScpUploadHandler) Write(s ssh.Session, entry *utils.FileEntry) (string, Text: metadata.Text, Title: metadata.Title, Hidden: metadata.Hidden, - UpdatedAt: &now, + UpdatedAt: &modTime, } _, err = h.DBPool.UpdatePost(&updatePost) if err != nil {