diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 3f9b46b..3b169e8 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -15,14 +15,14 @@ export function isISBN(str: string) { } export function makeFileName(book: Book, fileNameFormat: string) { + if (fileNameFormat) { + return replaceVariableSyntax(book, replaceDateInString(fileNameFormat)); + } const titleForFileName = replaceIllegalFileNameCharactersInString(book.title); if (!book.author) { return titleForFileName; } const authorForFileName = replaceIllegalFileNameCharactersInString(book.author); - if (fileNameFormat) { - return replaceVariableSyntax(book, replaceDateInString(fileNameFormat)); - } return `${titleForFileName} - ${authorForFileName}`; }