feat: Adjust z-index values for map components, enhance ISBN validation message, and add dynamic placeholders for reference inputs, add additional mimetypes
All checks were successful
CI / container-job (push) Successful in 38s

This commit is contained in:
Kaimbacher 2025-02-17 16:08:36 +01:00
parent a3031169ca
commit a41b091214
9 changed files with 314 additions and 400 deletions

View file

@ -22,7 +22,7 @@ async function checkDoiExists(doi: string): Promise<boolean> {
async function checkIsbnExists(isbn: string): Promise<boolean> {
try {
const response = await axios.get(`https://isbnsearch.org/isbn/${isbn}`);
return response.data && response.status == 200; // If title is returned, ISBN is valid
return response.status === 200 && response.data.includes('ISBN'); // Check if response contains ISBN information
} catch (error) {
return false; // If request fails, ISBN does not exist
}
@ -78,7 +78,7 @@ async function validateReference(value: unknown, options: Options, field: FieldC
} else if (type === ReferenceIdentifierTypes.ISBN) {
const isbnRegex = /^(?:\d{1,5}-\d{1,7}-\d{1,7}-[\dX]$|97[89]-\d{1,5}-\d{1,7}-\d{1,7}-\d)$/;
if (!isbnRegex.test(value)) {
field.report('The {{ field }} must be a valid ISBN', 'validateReference', field);
field.report('Invalid {{ field }}. Expected format: 978-3-16-148410-0 or similar.', 'validateReference', field);
} else {
try {
const exists = await checkIsbnExists(value);