fixed: 当链接是https 但资源引用是http 时导致的replace原文的图片链接失败。

This commit is contained in:
Dio Woo 2020-06-21 16:33:07 +08:00
parent ab33bf17d7
commit a059a677a2
2 changed files with 4 additions and 3 deletions

View File

@ -44,10 +44,10 @@ browser.runtime.onMessage.addListener( function( request, sender, sendResponse )
if (request.type == msg.MESSAGE_ACTION.NOTION_DL_IMG) {
try {
const option = request.value
const { url } = option
const { url, protocol } = option
const dlRes = await axios({
method: 'get',
url,
url: url.replace(/https?:/, protocol),
responseType: 'blob',
})

View File

@ -1390,7 +1390,8 @@ class Notion {
return new Promise((resolve, reject) => {
browser.runtime.sendMessage(
msg.Add(msg.MESSAGE_ACTION.NOTION_DL_IMG, {
url:url.replace(/https?:/, window.location.protocol),
url,
protocol: window.location.protocol
}),
(res) => {
if (res.done) {