escape filename in the ui

This commit is contained in:
Danny Coates 2017-07-18 11:53:43 -07:00
parent 45eccc1cad
commit b712a9d175
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
3 changed files with 7 additions and 9 deletions

View file

@ -21,7 +21,6 @@ $(document).ready(function() {
$('#download-btn').click(download); $('#download-btn').click(download);
function download() { function download() {
const fileReceiver = new FileReceiver(); const fileReceiver = new FileReceiver();
const name = document.createElement('p');
fileReceiver.on('progress', progress => { fileReceiver.on('progress', progress => {
$('#download-page-one').hide(); $('#download-page-one').hide();
@ -82,7 +81,6 @@ $(document).ready(function() {
return; return;
}) })
.then(([decrypted, fname]) => { .then(([decrypted, fname]) => {
name.innerText = fname;
const dataView = new DataView(decrypted); const dataView = new DataView(decrypted);
const blob = new Blob([dataView]); const blob = new Blob([dataView]);
const downloadUrl = URL.createObjectURL(blob); const downloadUrl = URL.createObjectURL(blob);

View file

@ -104,19 +104,19 @@ $(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').text(
`${file.name} (${(progress[0] / 1000).toFixed( `${file.name} (${(progress[0] / 1000).toFixed(
1 1
)}KB of ${(progress[1] / 1000).toFixed(1)}KB)` )}KB of ${(progress[1] / 1000).toFixed(1)}KB)`
); );
} else if (progress[1] < 1000000000) { } else if (progress[1] < 1000000000) {
$('.progress-text').html( $('.progress-text').text(
`${file.name} (${(progress[0] / 1000000).toFixed( `${file.name} (${(progress[0] / 1000000).toFixed(
1 1
)}MB of ${(progress[1] / 1000000).toFixed(1)}MB)` )}MB of ${(progress[1] / 1000000).toFixed(1)}MB)`
); );
} else { } else {
$('.progress-text').html( $('.progress-text').text(
`${file.name} (${(progress[0] / 1000000).toFixed( `${file.name} (${(progress[0] / 1000000).toFixed(
1 1
)}MB of ${(progress[1] / 1000000000).toFixed(1)}GB)` )}MB of ${(progress[1] / 1000000000).toFixed(1)}GB)`
@ -225,7 +225,7 @@ $(document).ready(function() {
const url = file.url.trim() + `#${file.secretKey}`.trim(); const url = file.url.trim() + `#${file.secretKey}`.trim();
$('#link').attr('value', url); $('#link').attr('value', url);
$('#copy-text').html( $('#copy-text').text(
'Copy and share the link to send your file: ' + file.name 'Copy and share the link to send your file: ' + file.name
); );
$popupText.attr('tabindex', '-1'); $popupText.attr('tabindex', '-1');

View file

@ -8,7 +8,7 @@
{{#if filename}} {{#if filename}}
<div id="download-page-one"> <div id="download-page-one">
<div class="title"> <div class="title">
Download <span id="dl-filename">{{{filename}}}</span> ({{{filesize}}}) Download <span id="dl-filename">{{filename}}</span> ({{filesize}})
</div> </div>
<div class="description"> <div class="description">
Your friend is sending you a file with Firefox Send, a service that allows you to share files with a safe, private, and encrypted link that automatically expires to ensure your stuff does not remain online forever. Your friend is sending you a file with Firefox Send, a service that allows you to share files with a safe, private, and encrypted link that automatically expires to ensure your stuff does not remain online forever.
@ -21,7 +21,7 @@
<div id="download-progress"> <div id="download-progress">
<div class="title"> <div class="title">
Downloading {{{filename}}} ({{{filesize}}}) Downloading {{filename}} ({{filesize}})
</div> </div>
<div class="description"> <div class="description">
Please leave this tab open while we fetch your file and decrypt it. Please leave this tab open while we fetch your file and decrypt it.
@ -34,7 +34,7 @@
</div> </div>
</div> </div>
<div class="upload"> <div class="upload">
<div class="progress-text">{{{filename}}}</div> <div class="progress-text">{{filename}}</div>
</div> </div>
</div> </div>