diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-07-09 23:19:01 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-07-09 23:19:01 +0200 |
commit | a7e0ab8a331a548c7e321856f07f85ebfd7a0e8a (patch) | |
tree | 77ad755d56e5692decd7f134ca65b7af78c394c4 /skate | |
parent | 7230af0cf1e15b133b90d3843c5fa7a0c5bd1f1a (diff) | |
download | refcat-a7e0ab8a331a548c7e321856f07f85ebfd7a0e8a.tar.gz refcat-a7e0ab8a331a548c7e321856f07f85ebfd7a0e8a.zip |
reduce: use a base64 encoded title as key
Diffstat (limited to 'skate')
-rw-r--r-- | skate/reduce.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/skate/reduce.go b/skate/reduce.go index 9babbae..5a2594d 100644 --- a/skate/reduce.go +++ b/skate/reduce.go @@ -18,6 +18,7 @@ package skate import ( + "encoding/base64" "fmt" "io" "log" @@ -161,7 +162,12 @@ func ZippyExactWiki(releases, wiki io.Reader, mr MatchResult, w io.Writer) error return err } var bref BiblioRef - bref.Key = fmt.Sprintf("%s_%s", slugifyString(wiki.PageTitle), target.Ident) // XXX: what should we use? + // We use base64 w/o padding of the original PageTitle as + // component for the id. XXX: ok for now? + key := fmt.Sprintf("%s_%s", + base64.RawURLEncoding.EncodeToString([]byte(wiki.PageTitle)), + target.Ident) + bref.Key = key bref.SourceWikipediaArticle = wiki.PageTitle bref.TargetReleaseIdent = target.Ident bref.TargetWorkIdent = target.WorkID |