当使用API访问Lightroom帐户中的目录时,生成的数据是代码和JSON的组合,开头为:
while (1) {}\n{\"base\":\"https://lr.adobe.io/v2/\",\"id\":\"7afe....这与仅指定JSON的文档不同。
发布于 2021-07-12 07:53:28
是的,你可以安全地修剪掉while (1) {}部件。
它只是防止隐藏在json结构中的恶意代码自动执行的一种安全措施。
不幸的是,这会使您的代码更加复杂。而不是简单的
const data = await fetch('https://lr.adobe.io/v2')
.then((response) => response.json());你必须这样做:
const data = await fetch('https://lr.adobe.io/v2')
.then((response) => response.text())
.then((text) => text.replace('while (1) {}', ''))
.then((json) => JSON.parse(json.trim()));https://stackoverflow.com/questions/66735218
复制相似问题