mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-31 03:52:01 +08:00
Catch JSON.parse errors
This commit is contained in:
parent
8980fc9cb1
commit
4473043623
1 changed files with 8 additions and 4 deletions
|
@ -21,11 +21,15 @@ const
|
|||
.replace(/tracking\.(printabout\.nl[^?]+)\?.*/gsi, (...m) => m[1])
|
||||
.replace(/^.+awstrack\.me\/.+(https:%2F%2F[^/]+)/gsi, (...m) => decodeURIComponent(m[1]))
|
||||
.replace(/^.+\/track\/click\/.+\?p=([a-z0-9_]+)$/gsi, (...m) => {
|
||||
let d = JSON.parse(atob(m[1].replace(/_/g,'/').replace(/-/g,'+')));
|
||||
if (d?.p) {
|
||||
d = JSON.parse(d.p);
|
||||
try {
|
||||
let d = JSON.parse(atob(m[1].replace(/_/g,'/').replace(/-/g,'+')));
|
||||
if (d?.p) {
|
||||
d = JSON.parse(d.p);
|
||||
}
|
||||
return d?.url || m[0];
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
return d?.url || m[0];
|
||||
})
|
||||
.replace(/([?&])utm_[a-z]+=[^&?#]*/gsi, '$1') // Urchin Tracking Module
|
||||
.replace(/([?&])ec_[a-z]+=[^&?#]*/gsi, '$1') // Sitecore
|
||||
|
|
Loading…
Reference in a new issue