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:
beyondkmp 2025-07-21 10:07:37 +08:00 committed by GitHub
parent 5259fc151b
commit 38bb9a77e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,7 +6,9 @@ const logger = loggerService.withContext('URLSchema:handleProvidersProtocolUrl')
function ParseData(data: string) {
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)
} catch (error) {