]> Sergey Matveev's repositories - feeder.git/commitdiff
Use title+content as more reliable item identifier
authorSergey Matveev <stargrave@stargrave.org>
Fri, 18 Feb 2022 07:00:19 +0000 (10:00 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 18 Feb 2022 07:01:15 +0000 (10:01 +0300)
cmd/feed2mdir/main.go
doc/mail.texi

index 9074cefab80bc14b375d4d787d3d2741715b5d67..5783d1f024401c4ee9bbbaa5ba0e1e1127bc84d4 100644 (file)
@@ -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, "<![CDATA[")
                what = strings.TrimSuffix(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))
index 346bc761b4a74a493bf2cb935f3052973224b960..6e422736db456e9c1f1fb6cf243dd643e53f47fa 100644 (file)
@@ -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.