Skip to content

Commit 237fd4c

Browse files
committed
temporary fix for CSP issue with Netlify function data
1 parent 26e33ac commit 237fd4c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/background.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ browser.runtime.onMessage.addListener(
1616
if (!tabsStorage[sender.tab.id]) {
1717
tabsStorage[sender.tab.id] = message.payload
1818
} else {
19+
// temporary fix when hit CSP
20+
if (!message.payload.modules.length) delete message.payload.modules
21+
if (!message.payload.plugins.length) delete message.payload.plugins
22+
1923
tabsStorage[sender.tab.id] = { ...tabsStorage[sender.tab.id], ...message.payload }
2024
}
2125

@@ -33,6 +37,14 @@ browser.runtime.onMessage.addListener(
3337
})
3438
showcase.isPublic = res.body.isPublic
3539
showcase.slug = res.body.slug
40+
41+
// temporary fix when hit CSP
42+
if (!showcase.modules.length && res.body.modules.length) {
43+
showcase.modules = res.body.modules
44+
}
45+
if (!showcase.plugins.length && res.body.plugins.length) {
46+
showcase.plugins = res.body.plugins
47+
}
3648
} catch (err) {}
3749
}
3850
// tabsStorage[sender.tab.id] = message.payload

0 commit comments

Comments
 (0)