mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: https error
This commit is contained in:
parent
ca34338b72
commit
d00ab5df5f
1 changed files with 5 additions and 3 deletions
|
|
@ -1039,11 +1039,13 @@ export function getUserSpeaker (userSetting) {
|
|||
* @returns {Promise<string>} 最终下载文件的存储位置
|
||||
*/
|
||||
export async function downloadFile (url, destPath, absolute = false, ignoreCertificateError = true) {
|
||||
let response = await fetch(url, {
|
||||
agent: new https.Agent({
|
||||
let init = {}
|
||||
if (ignoreCertificateError && url.startsWith('https')) {
|
||||
init.agent = new https.Agent({
|
||||
rejectUnauthorized: !ignoreCertificateError
|
||||
})
|
||||
})
|
||||
}
|
||||
let response = await fetch(url, init)
|
||||
if (!response.ok) {
|
||||
throw new Error(`download file http error: status: ${response.status}`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue