strip tracking parameters when parsing urls

pull/1/head
ansuz 7 years ago
parent af1ea4fd96
commit b96ea47f1f

@ -245,6 +245,17 @@ define([
hd.type === 'invite'); hd.type === 'invite');
}, "test support for invite urls"); }, "test support for invite urls");
assert(function (cb) {
var url = '/pad/?utm_campaign=new_comment&utm_medium=email&utm_source=thread_mailer#/1/edit/3Ujt4F2Sjnjbis6CoYWpoQ/usn4+9CqVja8Q7RZOGTfRgqI/';
var secret = Cryptpad.parsePadUrl(url);
return cb(secret.hashData.version === 1 &&
secret.hashData.mode === "edit" &&
secret.hashData.channel === "3Ujt4F2Sjnjbis6CoYWpoQ" &&
secret.hashData.key === "usn4+9CqVja8Q7RZOGTfRgqI" &&
!secret.hashData.present);
}, "test support for ugly tracking query paramaters in url");
assert(function (cb) { assert(function (cb) {
// TODO // TODO
return cb(true); return cb(true);

@ -114,6 +114,7 @@ Version 1
if (!href) { return ret; } if (!href) { return ret; }
if (href.slice(-1) !== '/') { href += '/'; } if (href.slice(-1) !== '/') { href += '/'; }
href = href.replace(/\/\?[^#]+#/, '/#');
var idx; var idx;

Loading…
Cancel
Save