From 01705291c4bb32dd2ab30756a66bc9463931f2a8 Mon Sep 17 00:00:00 2001 From: Han Xiao Date: Mon, 17 Mar 2025 14:44:28 +0800 Subject: [PATCH] fix: normalize url --- src/tools/read.ts | 1 + src/utils/url-tools.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/read.ts b/src/tools/read.ts index 1986c7c..a65d177 100644 --- a/src/tools/read.ts +++ b/src/tools/read.ts @@ -21,6 +21,7 @@ export function readUrl(url: string, withAllLinks?: boolean, tracker?: TokenTrac 'Content-Type': 'application/json', 'X-Retain-Images': 'none', 'X-Md-Link-Style': 'discarded', + 'X-Engine': 'direct' }; if (withAllLinks) { headers['X-With-Links-Summary'] = 'all' diff --git a/src/utils/url-tools.ts b/src/utils/url-tools.ts index b6078db..53ba628 100644 --- a/src/utils/url-tools.ts +++ b/src/utils/url-tools.ts @@ -466,7 +466,9 @@ export async function processURLs( (error?.name === 'ParamValidationError' && error.message?.includes('Domain')) || (error?.name === 'AssertionFailureError' && error.message?.includes('resolve host name')) || error?.message?.includes("Couldn't resolve host name") || - error?.message?.includes("could not be resolved") + error?.message?.includes("could not be resolved") || + error?.message?.includes("ERR_CERT_COMMON_NAME_INVALID") || + error?.message?.includes("ERR_CONNECTION_REFUSED") ) { let hostname = ''; try {