diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-07-09 23:46:53 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-07-09 23:46:53 +0200 |
commit | f8ee585574d31ab9c7a281ea2db095e37ad83389 (patch) | |
tree | 760e9bf55272ab570dc6f5309e81c324c3b59175 /skate | |
parent | a7e0ab8a331a548c7e321856f07f85ebfd7a0e8a (diff) | |
download | refcat-f8ee585574d31ab9c7a281ea2db095e37ad83389.tar.gz refcat-f8ee585574d31ab9c7a281ea2db095e37ad83389.zip |
wiki: use lowercase base32 of page title
* mostly case insensitive, same case as ident
Diffstat (limited to 'skate')
-rw-r--r-- | skate/reduce.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/skate/reduce.go b/skate/reduce.go index 5a2594d..cd63bb1 100644 --- a/skate/reduce.go +++ b/skate/reduce.go @@ -18,7 +18,7 @@ package skate import ( - "encoding/base64" + "encoding/base32" "fmt" "io" "log" @@ -144,6 +144,7 @@ func ZippyExactReleases(olr, releases io.Reader, matchResult MatchResult, w io.W func ZippyExactWiki(releases, wiki io.Reader, mr MatchResult, w io.Writer) error { var ( enc = json.NewEncoder(xio.NewSingleWriter(w)) + b32enc = base32.StdEncoding.WithPadding(base32.NoPadding) keyer = makeKeyFunc("\t", 1) grouper = func(g *zipkey.Group) error { var ( @@ -165,7 +166,7 @@ func ZippyExactWiki(releases, wiki io.Reader, mr MatchResult, w io.Writer) error // 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)), + strings.ToLower(b32enc.EncodeToString([]byte(wiki.PageTitle))), target.Ident) bref.Key = key bref.SourceWikipediaArticle = wiki.PageTitle |