Skip to content

Commit

Permalink
fix: create UID from URL hash if none is given.
Browse files Browse the repository at this point in the history
fix #38
  • Loading branch information
slurdge committed May 31, 2022
1 parent d159ec1 commit 27a38c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/goeland/fetch/feed.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package fetch

import (
"encoding/hex"
"fmt"
"hash/fnv"
"html"
"os"
"strings"
Expand Down Expand Up @@ -74,7 +76,11 @@ func fetchFeed(source *goeland.Source, feedLocation string, isFile bool) error {
}
}
}

}
if strings.TrimSpace(entry.UID) == "" {
hash := fnv.New64a()
hash.Write([]byte(entry.URL))
entry.UID = hex.EncodeToString(hash.Sum([]byte{}))
}
source.Entries = append(source.Entries, entry)
}
Expand Down

0 comments on commit 27a38c4

Please sign in to comment.