Skip to content

Commit

Permalink
ios: fix id
Browse files Browse the repository at this point in the history
  • Loading branch information
miku committed Jan 2, 2024
1 parent 73ced1f commit 47392b6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions formats/ios/article.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 47392b6

Please sign in to comment.