fix(clean_url): possible invalid adurl value

This commit is contained in:
MDLeom 2025-07-03 06:37:08 +00:00
parent 5873315cfe
commit 85d43577a6
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 5 additions and 2 deletions

View File

@ -63,8 +63,11 @@ const deSafelink = (urlStr) => {
// Google Ads
if (url.hostname.endsWith('doubleclick.net') || url.hostname.endsWith('googleadservices.com')) {
const paramUrl = url.searchParams.getAll('adurl').at(-1) || url.searchParams.getAll('url').at(-1) || url.searchParams.getAll('ds_dest_url').at(-1)
if (paramUrl) url = new URL(paramUrl)
let paramUrl = url.searchParams.getAll('adurl').at(-1) || url.searchParams.getAll('url').at(-1) || url.searchParams.getAll('ds_dest_url').at(-1)
if (paramUrl) {
paramUrl = paramUrl.replace(/^\/\//, 'https://')
url = new URL(paramUrl)
}
}
// Google Search