Skip to content

Commit

Permalink
fix(submission): Add new check on DOI that should start with "10."
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Oct 3, 2024
1 parent 293ccc0 commit 4c24e24
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/SubmissionForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const SUPPORTED_FIELDS = [
'',
];
// DOI does not contain comma
const doiRegex = /^[^,]+$/;
const doiRegex = /^10\.[^,]+$/;
// hal_struct_id is only digits
const halStructIdRegex = /^\d*$/;
// hal_id
Expand Down Expand Up @@ -286,11 +286,11 @@ const SubmissionForm = () => {
const errors = dataWithLine.filter(
(item) => item?.doi && !item?.doi?.match(doiRegex),
);
let errorMessage = 'Les DOI ne doivent pas contenir de virgule.';
let errorMessage = 'Les DOI doivent commencer par "10." et ne doivent pas contenir de virgule.';
errorMessage += ` Erreur(s) sur ${errors.length} DOI :`;
errorMessage += '<ul>';
errors.forEach((item) => {
errorMessage += `<li>Ligne ${item?.line} : DOI ${item?.doi}</li>`;
errorMessage += `<li>Ligne ${item?.line} : DOI : ${item?.doi}</li>`;
});
errorMessage += '</ul>';
setMessage(errorMessage);
Expand Down

0 comments on commit 4c24e24

Please sign in to comment.