mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-08 22:39:36 +08:00
fix: sanitize JSON input in ParseData function to handle single quotes and parentheses (#8333)
* fix: sanitize JSON input in ParseData function to handle single quotes and parentheses * format code
This commit is contained in:
parent
5259fc151b
commit
38bb9a77e0
@ -6,7 +6,9 @@ const logger = loggerService.withContext('URLSchema:handleProvidersProtocolUrl')
|
|||||||
|
|
||||||
function ParseData(data: string) {
|
function ParseData(data: string) {
|
||||||
try {
|
try {
|
||||||
const result = JSON.parse(Buffer.from(data, 'base64').toString('utf-8'))
|
const result = JSON.parse(
|
||||||
|
Buffer.from(data, 'base64').toString('utf-8').replaceAll("'", '"').replaceAll('(', '').replaceAll(')', '')
|
||||||
|
)
|
||||||
|
|
||||||
return JSON.stringify(result)
|
return JSON.stringify(result)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user