From c2404189eb4800764de13f28abc0bca2b3b5d848 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Tue, 8 Jun 2021 22:02:41 +0200 Subject: map: tweak isbn --- skate/map.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/skate/map.go b/skate/map.go index 17d9ed2..a6dc5f3 100644 --- a/skate/map.go +++ b/skate/map.go @@ -289,21 +289,12 @@ func MapperOpenLibraryReleaseNormalizedISBN(p []byte) (fields [][]byte, err erro } // There can be 10 and 13 variants in the data, we always want 13. for _, isbn := range doc.ExtIDs.ISBN { - if len(isbn) == 13 { - isbn13 = isbn + parsed := ParseIsbn(isbn) + if len(parsed) > 0 { + isbn13 = parsed[0] break } } - if isbn13 == "" { - // This is rarer, more expensive. - for _, isbn := range doc.ExtIDs.ISBN { - parsed := ParseIsbn(isbn) - if len(parsed) > 0 { - isbn13 = parsed[0] - break - } - } - } if isbn13 == "" { return nil, nil } else { -- cgit v1.2.3