Skip to content

Commit 6c3875b

Browse files
committed
fix book link parsing to account for links with dashes
1 parent d51f773 commit 6c3875b

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)