mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-02 21:12:02 +08:00
Bugfix: strip utm_ tracking failed
This commit is contained in:
parent
75766573e9
commit
121f6f0bf8
1 changed files with 2 additions and 2 deletions
|
@ -16,7 +16,7 @@ const
|
||||||
replaceWithChildren = node => node.replaceWith(...[...node.childNodes]),
|
replaceWithChildren = node => node.replaceWith(...[...node.childNodes]),
|
||||||
|
|
||||||
// Strip utm_* tracking
|
// Strip utm_* tracking
|
||||||
stripTracking = text => text.replace(/(\?|&|&)utm_[a-z]+=[^&?#]*/si, '$1');
|
stripTracking = text => text.replace(/([?&])utm_[a-z]+=[^&?#]*/gsi, '$1').replace(/&&+/, '');
|
||||||
|
|
||||||
export const
|
export const
|
||||||
|
|
||||||
|
@ -184,11 +184,11 @@ export const
|
||||||
|
|
||||||
else if ('A' === name) {
|
else if ('A' === name) {
|
||||||
value = oElement.href;
|
value = oElement.href;
|
||||||
value = stripTracking(value);
|
|
||||||
if (!/^([a-z]+):/i.test(value)) {
|
if (!/^([a-z]+):/i.test(value)) {
|
||||||
setAttribute('data-x-broken-href', value);
|
setAttribute('data-x-broken-href', value);
|
||||||
delAttribute('href');
|
delAttribute('href');
|
||||||
} else {
|
} else {
|
||||||
|
oElement.href = stripTracking(value);
|
||||||
setAttribute('target', '_blank');
|
setAttribute('target', '_blank');
|
||||||
setAttribute('rel', 'external nofollow noopener noreferrer');
|
setAttribute('rel', 'external nofollow noopener noreferrer');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue