mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-02 21:12:02 +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(/tracking\.(printabout\.nl[^?]+)\?.*/gsi, (...m) => m[1])
|
||||||
.replace(/^.+awstrack\.me\/.+(https:%2F%2F[^/]+)/gsi, (...m) => decodeURIComponent(m[1]))
|
.replace(/^.+awstrack\.me\/.+(https:%2F%2F[^/]+)/gsi, (...m) => decodeURIComponent(m[1]))
|
||||||
.replace(/^.+\/track\/click\/.+\?p=([a-z0-9_]+)$/gsi, (...m) => {
|
.replace(/^.+\/track\/click\/.+\?p=([a-z0-9_]+)$/gsi, (...m) => {
|
||||||
let d = JSON.parse(atob(m[1].replace(/_/g,'/').replace(/-/g,'+')));
|
try {
|
||||||
if (d?.p) {
|
let d = JSON.parse(atob(m[1].replace(/_/g,'/').replace(/-/g,'+')));
|
||||||
d = JSON.parse(d.p);
|
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(/([?&])utm_[a-z]+=[^&?#]*/gsi, '$1') // Urchin Tracking Module
|
||||||
.replace(/([?&])ec_[a-z]+=[^&?#]*/gsi, '$1') // Sitecore
|
.replace(/([?&])ec_[a-z]+=[^&?#]*/gsi, '$1') // Sitecore
|
||||||
|
|
Loading…
Reference in a new issue