Skip to content

Commit

Permalink
修改下载函数
Browse files Browse the repository at this point in the history
为默认Headers增加Host,解决一些网站无法下载文件的问题
  • Loading branch information
cnxysoft committed Jul 1, 2024
1 parent fa5c7ad commit 1457efa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common/utils/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ export async function httpDownload(options: string | HttpDownloadOptions): Promi
};
if (typeof options === 'string') {
url = options;
const host = new URL(url).hostname;
headers['Host'] = host;
} else {
url = options.url;
if (options.headers) {
Expand Down

0 comments on commit 1457efa

Please sign in to comment.