[Bug]: Crash when matching when author name ends in "???" #1496

Closed
opened 2026-04-24 23:47:26 +02:00 by adam · 3 comments
Owner

Originally created by @advplyr on GitHub (Oct 30, 2023).

Describe the issue

Originally found by searching for the title "die drei ??? und der grune geist" and no author.

The fuzzy match candidates end up checking for an author "die drei ???". Using this in a JS RegExp causes the crash

[2023-10-30 16:31:32] DEBUG: Book Search: title: "die drei ??? und der grune geist", author: "n. n.", provider: itunes (BookFinder.js:406)
/server/finders/BookFinder.js:204
        const authorRe = new RegExp(`(^| | by |)${this.cleanAuthor}(?= |$)`, "g")
                         ^

SyntaxError: Invalid regular expression: /(^| | by |)die drei ???(?= |$)/: Nothing to repeat
    at new RegExp (<anonymous>)
    at TitleCandidates.add (/server/finders/BookFinder.js:204:26)
    at BookFinder.search (/server/finders/BookFinder.js:380:27)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ApiRouter.findBooks (/server/controllers/SearchController.js:14:21)

Steps to reproduce the issue

  1. Go to match tab
  2. Enter any title and the author "die drei ???"

Audiobookshelf version

v2.5.0

How are you running audiobookshelf?

Docker

Originally created by @advplyr on GitHub (Oct 30, 2023). ### Describe the issue Originally found by searching for the title "die drei ??? und der grune geist" and no author. The fuzzy match candidates end up checking for an author "die drei ???". Using this in a JS RegExp causes the crash ``` [2023-10-30 16:31:32] DEBUG: Book Search: title: "die drei ??? und der grune geist", author: "n. n.", provider: itunes (BookFinder.js:406) /server/finders/BookFinder.js:204 const authorRe = new RegExp(`(^| | by |)${this.cleanAuthor}(?= |$)`, "g") ^ SyntaxError: Invalid regular expression: /(^| | by |)die drei ???(?= |$)/: Nothing to repeat at new RegExp (<anonymous>) at TitleCandidates.add (/server/finders/BookFinder.js:204:26) at BookFinder.search (/server/finders/BookFinder.js:380:27) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ApiRouter.findBooks (/server/controllers/SearchController.js:14:21) ``` ### Steps to reproduce the issue 1. Go to match tab 2. Enter any title and the author "die drei ???" ### Audiobookshelf version v2.5.0 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:47:26 +02:00
adam closed this issue 2026-04-24 23:47:27 +02:00
Author
Owner

@katertier commented on GitHub (Oct 31, 2023):

for the record, it's not only question marks:

"[" and "]" cause an "Unterminated character class" at the same location (/server/finders/BookFinder.js:204)

@katertier commented on GitHub (Oct 31, 2023): for the record, it's not only question marks: "[" and "]" cause an "Unterminated character class" at the same location (/server/finders/BookFinder.js:204)
Author
Owner

@advplyr commented on GitHub (Oct 31, 2023):

Thanks. This is fixed on edge docker image if anyone needs this now.

@advplyr commented on GitHub (Oct 31, 2023): Thanks. This is fixed on `edge` docker image if anyone needs this now.
Author
Owner

@advplyr commented on GitHub (Nov 28, 2023):

Fixed in v2.6.0

@advplyr commented on GitHub (Nov 28, 2023): Fixed in [v2.6.0](https://github.com/advplyr/audiobookshelf/releases/tag/v2.6.0)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1496