Fix issue with adding valid DOIs to ref manager #1764
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to solve ResearchHub/issues#34.
The issue seems to have been
issn.join
failing ifissn
isnull
or not an array. The fix involves adding a check to ensureissn
is an array before calling thejoin
method. The updated code usesArray.isArray(issn) ? issn.join(", ") : ""
, which checks ifissn
is an array; if it is, it joins the array elements into a string separated by commas. Ifissn
is not an array or isnull
, it defaults to an empty string. This prevents the application from throwing an error when trying to calljoin
on anull
value.I ran the code locally and was able to add the DOI that caused the issue: