Merge pull request #197 from mozilla/fixes195and192

fixes issues 195 and 192
This commit is contained in:
Abhinav Adduri 2017-07-17 16:26:16 -07:00 committed by GitHub
commit 729f716e97
4 changed files with 7 additions and 7 deletions

View File

@ -32,8 +32,8 @@ $(document).ready(function() {
$('.percent-number').html(`${Math.floor(percent * 100)}`);
if (progress[1] < 1000000) {
$('.progress-text').html(
`${filename} (${(progress[0] / 1000).toFixed(1)}KB of ${(progress[1] /
1000).toFixed(1)}KB)`
`${filename} (${(progress[0] / 1000).toFixed(1)}KB of
${(progress[1] / 1000).toFixed(1)}KB)`
);
} else if (progress[1] < 1000000000) {
$('.progress-text').html(

View File

@ -88,7 +88,7 @@ class FileReceiver extends EventEmitter {
this.emit('safe', true);
return Promise.all([
decrypted,
fname
decodeURIComponent(fname)
]);
}
})

View File

@ -130,7 +130,7 @@ class FileSender extends EventEmitter {
JSON.stringify({
aad: arrayToHex(hash),
id: fileId,
filename: file.name
filename: encodeURIComponent(file.name)
})
);
xhr.send(fd);

View File

@ -98,7 +98,7 @@ app.get('/download/:id', (req, res) => {
.length(id)
.then(contentLength => {
res.render('download', {
filename: filename,
filename: decodeURIComponent(filename),
filesize: bytes(contentLength),
trackerId: conf.analytics_id,
dsn: conf.sentry_id
@ -193,10 +193,10 @@ app.post('/upload', (req, res, next) => {
}
if (
!validateIV(meta.id) ||
!meta.hasOwnProperty('aad') ||
!meta.hasOwnProperty('id') ||
!meta.hasOwnProperty('filename')
!meta.hasOwnProperty('filename') ||
!validateIV(meta.id)
) {
res.sendStatus(404);
return;