Skip to content

Commit c156ecf

Browse files
authored
fix: decode OpenLibrary author response before accessing fields (#519)
1 parent 447de3d commit c156ecf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/src/BookRepository/OpenLibraryBookRepository.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public function find(string $url): ?Book
3636

3737
$book->author = null;
3838
if (isset($data['authors'][0]['key'])) {
39-
$author = $this->openLibraryClient->request('GET', $data['authors'][0]['key'] . '.json', $options);
39+
$authorResponse = $this->openLibraryClient->request('GET', $data['authors'][0]['key'] . '.json', $options);
40+
$author = $this->decoder->decode($authorResponse->getContent(), 'json');
4041
if (isset($author['name'])) {
4142
$book->author = $author['name'];
4243
}

0 commit comments

Comments
 (0)