Skip to content

Commit

Permalink
fix: potential JSON parse error brought by trailing comma
Browse files Browse the repository at this point in the history
  • Loading branch information
plainheart committed Dec 17, 2023
1 parent 71ba5c7 commit 50641e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/generate-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const DEFAULT_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKi

// fetch config
const richTranslateParams = JSON.parse(
body.match(/params_RichTranslate\s?=\s?([^;]+);/)[1]
body.match(/params_RichTranslate\s?=\s?([^;]+);/)[1].replace(/,]$/, ']')
)
const config = {
websiteEndpoint: richTranslateParams[1],
Expand Down

0 comments on commit 50641e5

Please sign in to comment.