File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const deriveCreatorsFromRelatedPubs = (
4545 . map ( ( pub ) => makeDataciteCreatorFromAuthorPub ( pub , creatorNameFieldSlug ) ) ;
4646
4747const makeDatacitePayload = async ( pub : ActionPub , config : Config ) : Promise < Payload > => {
48+ const doiFieldSlug = config . pubFields . doi ?. [ 0 ] ;
4849 const titleFieldSlug = config . pubFields . title ?. [ 0 ] ;
4950 const urlFieldSlug = expect (
5051 config . pubFields . url ?. [ 0 ] ,
@@ -101,7 +102,9 @@ const makeDatacitePayload = async (pub: ActionPub, config: Config): Promise<Payl
101102
102103 const publicationYear = new Date ( publicationDate ) . getFullYear ( ) ;
103104
104- let doi = config . doi ;
105+ let doi =
106+ config . doi ||
107+ ( pub . values . find ( ( v ) => v . fieldSlug === doiFieldSlug ) ?. value as string | undefined ) ;
105108
106109 if ( ! doi ) {
107110 assert (
You can’t perform that action at this time.
0 commit comments