Mozzo1000 / booklogr

A simple, self-hosted service to keep track of your personal library 📚
https://demo.booklogr.app
Apache License 2.0
162 stars 1 forks source link

Handle OpenLibrary search results with no ISBN #18

Closed Terrance closed 1 month ago

Terrance commented 1 month ago

Using the demo instance, some search results fail to load, seemingly because one or more entries do not contain an isbn field:

Uncaught (in promise) TypeError: can't access property 0, v.data.docs[_].isbn is undefined

Searching for misc can reproduce this -- API response from OpenLibrary:

{
    "numFound": 739,
    "start": 0,
    "numFoundExact": true,
    "docs": [
        ...
        {
            "title": "Station misc"
        },
        {
            "title": "[Misc. items]"
        },
        {
            "isbn": [
                "1791889182",
                "9781791889180"
            ],
            "title": "Misc"
        },
        ...
    ],
    "num_found": 739,
    "q": "misc",
    "offset": 0
}

(The search demo in #8 does seem to handle these and show None in place of the ISBN.)

Mozzo1000 commented 1 month ago

Thank you for finding and reporting this bug! I have fixed this in a97c089 by not having books with no ISBN to be able to show up in search results. I am aware that not all books have ISBN:s but that is a requirement at the moment to distinguish between books.