Merge pull request #197 from mozilla/fixes195and192
fixes issues 195 and 192
This commit is contained in:
commit
729f716e97
|
@ -32,8 +32,8 @@ $(document).ready(function() {
|
||||||
$('.percent-number').html(`${Math.floor(percent * 100)}`);
|
$('.percent-number').html(`${Math.floor(percent * 100)}`);
|
||||||
if (progress[1] < 1000000) {
|
if (progress[1] < 1000000) {
|
||||||
$('.progress-text').html(
|
$('.progress-text').html(
|
||||||
`${filename} (${(progress[0] / 1000).toFixed(1)}KB of ${(progress[1] /
|
`${filename} (${(progress[0] / 1000).toFixed(1)}KB of
|
||||||
1000).toFixed(1)}KB)`
|
${(progress[1] / 1000).toFixed(1)}KB)`
|
||||||
);
|
);
|
||||||
} else if (progress[1] < 1000000000) {
|
} else if (progress[1] < 1000000000) {
|
||||||
$('.progress-text').html(
|
$('.progress-text').html(
|
||||||
|
|
|
@ -88,7 +88,7 @@ class FileReceiver extends EventEmitter {
|
||||||
this.emit('safe', true);
|
this.emit('safe', true);
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
decrypted,
|
decrypted,
|
||||||
fname
|
decodeURIComponent(fname)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -130,7 +130,7 @@ class FileSender extends EventEmitter {
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
aad: arrayToHex(hash),
|
aad: arrayToHex(hash),
|
||||||
id: fileId,
|
id: fileId,
|
||||||
filename: file.name
|
filename: encodeURIComponent(file.name)
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
xhr.send(fd);
|
xhr.send(fd);
|
||||||
|
|
|
@ -98,7 +98,7 @@ app.get('/download/:id', (req, res) => {
|
||||||
.length(id)
|
.length(id)
|
||||||
.then(contentLength => {
|
.then(contentLength => {
|
||||||
res.render('download', {
|
res.render('download', {
|
||||||
filename: filename,
|
filename: decodeURIComponent(filename),
|
||||||
filesize: bytes(contentLength),
|
filesize: bytes(contentLength),
|
||||||
trackerId: conf.analytics_id,
|
trackerId: conf.analytics_id,
|
||||||
dsn: conf.sentry_id
|
dsn: conf.sentry_id
|
||||||
|
@ -193,10 +193,10 @@ app.post('/upload', (req, res, next) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!validateIV(meta.id) ||
|
|
||||||
!meta.hasOwnProperty('aad') ||
|
!meta.hasOwnProperty('aad') ||
|
||||||
!meta.hasOwnProperty('id') ||
|
!meta.hasOwnProperty('id') ||
|
||||||
!meta.hasOwnProperty('filename')
|
!meta.hasOwnProperty('filename') ||
|
||||||
|
!validateIV(meta.id)
|
||||||
) {
|
) {
|
||||||
res.sendStatus(404);
|
res.sendStatus(404);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue