From c446679adbfc913488f4166615907062d4f17e27 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 18 Feb 2022 10:00:19 +0300 Subject: [PATCH] Use title+content as more reliable item identifier --- cmd/feed2mdir/main.go | 6 +++++- doc/mail.texi | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/feed2mdir/main.go b/cmd/feed2mdir/main.go index 9074cef..5783d1f 100644 --- a/cmd/feed2mdir/main.go +++ b/cmd/feed2mdir/main.go @@ -58,7 +58,6 @@ func main() { } else { when = &now } - fn := hex.EncodeToString(h.Sum(nil)[:sha512.Size/2]) var what string if len(item.Content) == 0 { what = item.Description @@ -67,6 +66,11 @@ func main() { } what = strings.TrimPrefix(what, "") + h := sha512.New() + h.Write([]byte(item.Title)) + h.Write([]byte{0}) + h.Write([]byte(what)) + fn := hex.EncodeToString(h.Sum(nil)[:sha512.Size/2]) exists := false for _, d := range []string{"cur", "new"} { entries, err := os.ReadDir(path.Join(mdir, d)) diff --git a/doc/mail.texi b/doc/mail.texi index 346bc76..6e42273 100644 --- a/doc/mail.texi +++ b/doc/mail.texi @@ -15,7 +15,7 @@ Content-Type: text/html; charset=utf-8 Base64-encoded item's content. That is HTML as a rule. @end verbatim -Each message is placed under @code{HEX(SHA512/2(title+date))} filename. +Each message is placed under @code{HEX(SHA512/2(title+content))} filename. Unfortunately many feeds does not provide any date information at all. Often multiple entries contain the same date. So you can not solely depend on update/publish date. -- 2.44.0