Merge pull request #1408 from drakkein/master
Strip tracking URL params
This commit is contained in:
commit
006ee1d2e6
|
@ -74,7 +74,9 @@ module.exports = function(state, emit) {
|
||||||
const password = el.value;
|
const password = el.value;
|
||||||
if (password.length > 0) {
|
if (password.length > 0) {
|
||||||
document.getElementById('password-btn').disabled = true;
|
document.getElementById('password-btn').disabled = true;
|
||||||
state.fileInfo.url = window.location.href;
|
// Strip any url parameters between fileId and secretKey
|
||||||
|
const fileInfoUrl = window.location.href.replace(/\?.+#/, '#');
|
||||||
|
state.fileInfo.url = fileInfoUrl;
|
||||||
state.fileInfo.password = password;
|
state.fileInfo.password = password;
|
||||||
emit('getMetadata');
|
emit('getMetadata');
|
||||||
}
|
}
|
||||||
|
|
|
@ -4092,6 +4092,11 @@
|
||||||
"randomfill": "^1.0.3"
|
"randomfill": "^1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"crypto-random-string": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA=="
|
||||||
|
},
|
||||||
"css": {
|
"css": {
|
||||||
"version": "2.2.4",
|
"version": "2.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz",
|
||||||
|
@ -7287,6 +7292,27 @@
|
||||||
"stream-events": "^1.0.4"
|
"stream-events": "^1.0.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"configstore": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-eE/hvMs7qw7DlcB5JPRnthmrITuHMmACUJAp89v6PT6iOqzoLS7HRWhBtuHMlhNHo2AhUSA/3Dh1bKNJHcublQ==",
|
||||||
|
"requires": {
|
||||||
|
"dot-prop": "^5.1.0",
|
||||||
|
"graceful-fs": "^4.1.2",
|
||||||
|
"make-dir": "^3.0.0",
|
||||||
|
"unique-string": "^2.0.0",
|
||||||
|
"write-file-atomic": "^3.0.0",
|
||||||
|
"xdg-basedir": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dot-prop": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-n1oC6NBF+KM9oVXtjmen4Yo7HyAVWV2UUl50dCYJdw2924K6dX9bf9TTTWaKtYlRn0FEtxG27KS80ayVLixxJA==",
|
||||||
|
"requires": {
|
||||||
|
"is-obj": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"duplexify": {
|
"duplexify": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz",
|
||||||
|
@ -7298,6 +7324,11 @@
|
||||||
"stream-shift": "^1.0.0"
|
"stream-shift": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"is-obj": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="
|
||||||
|
},
|
||||||
"pump": {
|
"pump": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||||
|
@ -7326,6 +7357,17 @@
|
||||||
"string_decoder": "^1.1.1",
|
"string_decoder": "^1.1.1",
|
||||||
"util-deprecate": "^1.0.1"
|
"util-deprecate": "^1.0.1"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"write-file-atomic": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-EIgkf60l2oWsffja2Sf2AL384dx328c0B+cIYPTQq5q2rOYuDV00/iPFBOUiDKKwKMOhkymH8AidPaRvzfxY+Q==",
|
||||||
|
"requires": {
|
||||||
|
"imurmurhash": "^0.1.4",
|
||||||
|
"is-typedarray": "^1.0.0",
|
||||||
|
"signal-exit": "^3.0.2",
|
||||||
|
"typedarray-to-buffer": "^3.1.5"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -7667,8 +7709,7 @@
|
||||||
"graceful-fs": {
|
"graceful-fs": {
|
||||||
"version": "4.1.15",
|
"version": "4.1.15",
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
|
||||||
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
|
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"grapheme-splitter": {
|
"grapheme-splitter": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
|
@ -8392,8 +8433,7 @@
|
||||||
"imurmurhash": {
|
"imurmurhash": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||||
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
|
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"indent-string": {
|
"indent-string": {
|
||||||
"version": "3.2.0",
|
"version": "3.2.0",
|
||||||
|
@ -9989,6 +10029,21 @@
|
||||||
"sourcemap-codec": "^1.4.1"
|
"sourcemap-codec": "^1.4.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"make-dir": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-grNJDhb8b1Jm1qeqW5R/O63wUo4UXo2v2HMic6YT9i/HBlF93S8jkMgH7yugvY9ABDShH4VZMn8I+U8+fCNegw==",
|
||||||
|
"requires": {
|
||||||
|
"semver": "^6.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"semver": {
|
||||||
|
"version": "6.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||||
|
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"make-plural": {
|
"make-plural": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/make-plural/-/make-plural-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/make-plural/-/make-plural-4.3.0.tgz",
|
||||||
|
@ -14885,8 +14940,7 @@
|
||||||
"signal-exit": {
|
"signal-exit": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"simple-swizzle": {
|
"simple-swizzle": {
|
||||||
"version": "0.2.2",
|
"version": "0.2.2",
|
||||||
|
@ -16613,6 +16667,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
|
||||||
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
|
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
|
||||||
},
|
},
|
||||||
|
"typedarray-to-buffer": {
|
||||||
|
"version": "3.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
|
||||||
|
"integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
|
||||||
|
"requires": {
|
||||||
|
"is-typedarray": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"ua-parser-js": {
|
"ua-parser-js": {
|
||||||
"version": "0.7.20",
|
"version": "0.7.20",
|
||||||
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.20.tgz",
|
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.20.tgz",
|
||||||
|
@ -16755,6 +16817,14 @@
|
||||||
"imurmurhash": "^0.1.4"
|
"imurmurhash": "^0.1.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"unique-string": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==",
|
||||||
|
"requires": {
|
||||||
|
"crypto-random-string": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"unist-util-find-all-after": {
|
"unist-util-find-all-after": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/unist-util-find-all-after/-/unist-util-find-all-after-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/unist-util-find-all-after/-/unist-util-find-all-after-1.0.4.tgz",
|
||||||
|
|
|
@ -82,4 +82,29 @@ describe('Firefox Send', function() {
|
||||||
// check if upload and download file sizes are equal
|
// check if upload and download file sizes are equal
|
||||||
assert.equal(uploadSize, downloadSize);
|
assert.equal(uploadSize, downloadSize);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(`should upload and download file with added tracking parameter`, function() {
|
||||||
|
const trackingUrl =
|
||||||
|
'?fbclid=IaMFak3Tr4ck1ng1d_SDlP0shBk8SM2EN3cCLFKpHVl-k-Pvv0sf9Zy0tnTu9srqVY';
|
||||||
|
const password = 'strongpassword';
|
||||||
|
|
||||||
|
browser.chooseFile(
|
||||||
|
homePage.uploadInput,
|
||||||
|
`${testFilesPath}/${testFiles[0]}`
|
||||||
|
);
|
||||||
|
browser.waitForExist(homePage.addPassword);
|
||||||
|
browser.click(homePage.addPassword);
|
||||||
|
browser.waitForExist(homePage.passwordInput);
|
||||||
|
browser.setValue(homePage.passwordInput, password);
|
||||||
|
browser.click(homePage.uploadButton);
|
||||||
|
browser.waitForExist(homePage.shareUrl);
|
||||||
|
const shareUrl = browser.getValue(homePage.shareUrl);
|
||||||
|
const downloadPage = new DownloadPage(
|
||||||
|
shareUrl.replace('#', `${trackingUrl}#`)
|
||||||
|
);
|
||||||
|
downloadPage.open();
|
||||||
|
downloadPage.downloadUsingPassword(password);
|
||||||
|
browser.waitForExist(downloadPage.downloadComplete);
|
||||||
|
assert.ok(fs.existsSync(path.join(downloadDir, testFiles[0])));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,23 +4,22 @@ const Page = require('./page');
|
||||||
class DownloadPage extends Page {
|
class DownloadPage extends Page {
|
||||||
constructor(path) {
|
constructor(path) {
|
||||||
super(path);
|
super(path);
|
||||||
this.fileId = /download\/(\w+)\/#/.exec(path)[1];
|
this.fileId = /download\/(\w+)\/\??.*#/.exec(path)[1];
|
||||||
this.downloadButton = '#download-btn';
|
this.downloadButton = '#download-btn';
|
||||||
this.downloadComplete = '#download-complete';
|
this.downloadComplete = '#download-complete';
|
||||||
|
this.passwordInput = '#password-input';
|
||||||
|
this.passwordButton = '#password-btn';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
downloadUsingPassword(password) {
|
||||||
* @function waitForPageToLoad
|
browser.waitForExist(this.passwordInput);
|
||||||
* @returns {Object} An object representing the page.
|
browser.setValue(this.passwordInput, password);
|
||||||
* @throws ElementNotFound
|
browser.click(this.passwordButton);
|
||||||
*/
|
return browser.click(this.downloadButton);
|
||||||
waitForPageToLoad() {
|
|
||||||
super.waitForPageToLoad();
|
|
||||||
browser.waitForExist(this.downloadButton);
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
|
browser.waitForExist(this.downloadButton);
|
||||||
return browser.click(this.downloadButton);
|
return browser.click(this.downloadButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ class HomePage extends Page {
|
||||||
this.progress = 'progress';
|
this.progress = 'progress';
|
||||||
this.shareUrl = '#share-url';
|
this.shareUrl = '#share-url';
|
||||||
this.downloadCountSelect = '#expire-after-dl-count-select';
|
this.downloadCountSelect = '#expire-after-dl-count-select';
|
||||||
|
this.addPassword = '#add-password';
|
||||||
|
this.passwordInput = '#password-input';
|
||||||
|
this.passwordButton = '#password-btn';
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForPageToLoad() {
|
waitForPageToLoad() {
|
||||||
|
|
Loading…
Reference in New Issue