Skip to content

Commit a393a96

Browse files
authored
Merge pull request #251 from aemonm/main
fix book link parsing to account for links with dashes
2 parents d51f773 + 6c3875b commit a393a96

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/hooks/books.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export const usePreparedBooks = (books, images) => {
3535

3636
if (preparedBook.buy && preparedBook.buy !== '') {
3737
preparedBook.buyList = preparedBook.buy.split(',').map((ord) => {
38-
const [label, link] = ord.split('-');
38+
// split on first occurence of "-" as some links contain dashes
39+
const [label, link] = ord.split(/-(.+)/);
3940
return { label, link };
4041
});
4142
}

0 commit comments

Comments
 (0)