【发布时间】:2018-08-23 05:58:08
【问题描述】:
在我的 Meteor/Cordova 项目中,用户可以上传图片。然后将此图像上传到云服务。但在此之前,我已经想向用户显示上传的图像。立即地!所以我把 cdvfile-Url 设置为<img>s "src"。例如:
<img src="cdvfile://localhost/root/storage/emulated/0/x/y.jpg" />
我的 CSP 元标记如下所示:
<meta http-equiv="Content-Security-Policy" content="default-src *; img-src *">
不幸的是,这就是我得到的结果,虽然元标记不是很严格:
拒绝加载图片 'cdvfile://localhost/root/storage/emulated/0/x/y.jpg' 因为它 违反以下内容安全策略指令:“img-src *”。
我尝试了 CSP 元标记的大量变体,但都没有成功。我尝试过使用和不使用cordova-plugin-whitelist。谁有线索可以帮忙?
谢谢
【问题讨论】:
-
在内容属性的星号前添加斜杠会发生什么?
-
不起作用。它只会导致更多错误:“内容安全策略指令 'img-src' 的源列表包含无效源:'/*'。它将被忽略。”
标签: cordova meteor cordova-plugins content-security-policy