From 47392b6df4ee7f7b3d93546b43f88763cdab0941 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Tue, 2 Jan 2024 14:18:37 +0100 Subject: [PATCH] ios: fix id --- formats/ios/article.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/formats/ios/article.go b/formats/ios/article.go index f5392238..5f9c3f02 100644 --- a/formats/ios/article.go +++ b/formats/ios/article.go @@ -58,13 +58,14 @@ type Article struct { jats.Article } -// Identifiers returns the doi and the dependent url and recordID in a struct. -// Records from this source do not need a DOI necessarily. +// Identifiers returns identifiers. func (article *Article) Identifiers() (jats.Identifiers, error) { - locator := article.Front.Article.SelfURI.Value - - doi := DOIPattern.FindString(locator) - id := fmt.Sprintf("ai-%s-%s", SourceID, base64.RawURLEncoding.EncodeToString([]byte(locator))) + doi, err := article.DOI() + if err != nil { + return jats.Identifiers{}, err + } + locator := fmt.Sprintf("https://doi.org/%s", doi) + id := fmt.Sprintf("ai-%s-%s", SourceID, base64.RawURLEncoding.EncodeToString([]byte(doi))) return jats.Identifiers{DOI: doi, URL: locator, ID: id}, nil }