From 9feb6866ee914afe1955deb299f63dc65565d5b0 Mon Sep 17 00:00:00 2001 From: Arash Mousavi Date: Thu, 31 May 2018 14:14:28 +0000 Subject: [PATCH 01/52] Pontoon: Update Persian (fa) localization of Test Pilot: Firefox Send Localization authors: - Arash Mousavi --- public/locales/fa/send.ftl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/fa/send.ftl b/public/locales/fa/send.ftl index b2dfbf82..38669dff 100644 --- a/public/locales/fa/send.ftl +++ b/public/locales/fa/send.ftl @@ -26,6 +26,16 @@ uploadSuccessConfirmHeader = آماده برای ارسال uploadSvgAlt = بارگذاری uploadSuccessTimingHeader = پیوند به پرونده شما بعد از ۱ بار دانلود یا ۲۴ ساعت حذف خواهد شد. expireInfo = این پیوند به فایل شما پس از { $downloadCount } یا { $timespan } منقضی خواهد شد. +downloadCount = + { $num -> + [one] ۱ بارگیری + *[other] { $num } بارگیری + } +timespanHours = + { $num -> + [one] ۱ ساعت + *[other] { $num } ساعت + } copyUrlFormLabelWithName = برای ارسال پرونده پیوند آن را رونوشت و به اشتراک بگذارید: { $filename } copyUrlFormButton = رونوشت به کلیپ‌بورد copiedUrl = رونوشت شد! From 0a71c8c724a1933b61b521ed7c583b11e1dc75dd Mon Sep 17 00:00:00 2001 From: Michal Stanke Date: Sat, 2 Jun 2018 11:12:06 +0000 Subject: [PATCH 02/52] Pontoon: Update Czech (cs) localization of Test Pilot: Firefox Send Localization authors: - Michal Stanke --- public/locales/cs/send.ftl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/locales/cs/send.ftl b/public/locales/cs/send.ftl index ab869ef0..b838058f 100644 --- a/public/locales/cs/send.ftl +++ b/public/locales/cs/send.ftl @@ -26,12 +26,14 @@ uploadSuccessConfirmHeader = Připraveno k odeslání uploadSvgAlt = Nahrát uploadSuccessTimingHeader = Platnost odkazu na váš soubor vyprší po jeho prvním stažení, nebo po 24 hodinách. expireInfo = Platnost odkazu na váš soubor vyprší po { $downloadCount } nebo { $timespan }. -downloadCount = { $num -> +downloadCount = + { $num -> [one] jednom stažení [few] { $num } staženích *[other] { $num } staženích } -timespanHours = { $num -> +timespanHours = + { $num -> [one] jedné hodině [few] { $num } hodinách *[other] { $num } hodinách @@ -88,8 +90,8 @@ expiryFileList = Platnost vyprší za deleteFileList = Smazat nevermindButton = Nevadí legalHeader = Podmínky a ochrana soukromí -legalNoticeTestPilot = Firefox Send je ve fázi experimentu projektu Test Pilot a platí tak pro něj stejné Podmínky používání a Zásady ochrany soukromí. Více o tomto experimentu a sbíraných datech se dozvíte zde. -legalNoticeMozilla = Používání webové služby Firefox Send se řídí Zásadami ochrany soukromí a Podmínkami používání webových stránek Mozilly. +legalNoticeTestPilot = Firefox Send je ve fázi experimentu projektu Test Pilot a platí tak pro něj stejné Podmínky používání a Zásady ochrany osobních údajů. Více o tomto experimentu a sbíraných datech se dozvíte zde. +legalNoticeMozilla = Používání webové služby Firefox Send se řídí Zásadami ochrany osobních údajů a Podmínkami používání webových stránek Mozilly. deletePopupText = Smazat tento soubor? deletePopupYes = Ano deletePopupCancel = Zrušit From 5274b732b28e0c0dc3154cf3905d5533527d8994 Mon Sep 17 00:00:00 2001 From: eljuno Date: Sat, 2 Jun 2018 19:11:16 +0000 Subject: [PATCH 03/52] Pontoon: Update Indonesian (id) localization of Test Pilot: Firefox Send Localization authors: - eljuno --- public/locales/id/send.ftl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/locales/id/send.ftl b/public/locales/id/send.ftl index 71ddb179..01323e01 100644 --- a/public/locales/id/send.ftl +++ b/public/locales/id/send.ftl @@ -112,5 +112,9 @@ enableJavascript = Silakan aktifkan JavaScript dan coba lagi. expiresHoursMinutes = { $hours }j { $minutes }m # A short representation of a countdown timer containing the number of minutes remaining as digits, example "56m" expiresMinutes = { $minutes }m +# A short status message shown when a password is successfully set +passwordIsSet = Sandi diatur # A short status message shown when the user enters a long password maxPasswordLength = Panjang sandi maksimal: { $length } +# A short status message shown when there was an error setting the password +passwordSetError = Tidak bisa menyetel sandi ini From 0edfc8405f0e3ad7b853bf98e77083afd81afca9 Mon Sep 17 00:00:00 2001 From: Brainlulz Date: Sun, 3 Jun 2018 11:36:20 +0200 Subject: [PATCH 04/52] fix: added a tabindex to the CopyUrl and Delete icon --- app/templates/file/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/templates/file/index.js b/app/templates/file/index.js index 2d7d8937..0d83c1ad 100644 --- a/app/templates/file/index.js +++ b/app/templates/file/index.js @@ -19,7 +19,8 @@ module.exports = function(file, state, emit) { onclick=${copyClick} src="${assets.get('copy-16.svg')}" class="cursor--pointer" - title="${state.translate('copyUrlHover')}"> + title="${state.translate('copyUrlHover')}" + tabindex="0"> @@ -33,7 +34,8 @@ module.exports = function(file, state, emit) { onclick=${showPopup} src="${assets.get('close-16.svg')}" class="cursor--pointer" - title="${state.translate('deleteButtonHover')}"> + title="${state.translate('deleteButtonHover')}" + tabindex="0"> ${deletePopup( state.translate('deletePopupText'), state.translate('deletePopupYes'), From f0530975ac6cb1f799dbd30d3f0973e47751cb4b Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Tue, 5 Jun 2018 13:20:41 -0700 Subject: [PATCH 05/52] updated aws-sdk --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1a4e734f..1f47152a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -527,19 +527,19 @@ } }, "aws-sdk": { - "version": "2.206.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.206.0.tgz", - "integrity": "sha1-I1yhCVdsiI8kZ9HBDDOvfjQtO+E=", + "version": "2.251.1", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.251.1.tgz", + "integrity": "sha1-D35EtFwierfVxjGIxCxqyRPyW/M=", "requires": { "buffer": "4.9.1", "events": "1.1.1", + "ieee754": "1.1.8", "jmespath": "0.15.0", "querystring": "0.2.0", "sax": "1.2.1", "url": "0.10.3", "uuid": "3.1.0", - "xml2js": "0.4.17", - "xmlbuilder": "4.2.1" + "xml2js": "0.4.17" } }, "aws-sign": { diff --git a/package.json b/package.json index 11e39818..83d511f0 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "webpack-unassert-loader": "^1.2.0" }, "dependencies": { - "aws-sdk": "^2.206.0", + "aws-sdk": "^2.251.1", "babel-polyfill": "^6.26.0", "choo": "^6.10.0", "cldr-core": "^32.0.0", From 480a06c4262969b36742badd1e6c6a0a5be7ac3c Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Tue, 5 Jun 2018 15:26:24 -0700 Subject: [PATCH 06/52] track bytes sent on download --- server/routes/download.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/routes/download.js b/server/routes/download.js index bfd667ed..b320d899 100644 --- a/server/routes/download.js +++ b/server/routes/download.js @@ -14,8 +14,12 @@ module.exports = async function(req, res) { 'WWW-Authenticate': `send-v1 ${req.nonce}` }); const file_stream = storage.get(id); - + let sentBytes = 0; + file_stream.on('data', c => (sentBytes += c.length)); file_stream.on('end', async () => { + if (sentBytes < contentLength) { + return; + } const dl = meta.dl + 1; const dlimit = meta.dlimit; try { From 608112d56c643fd7a50e11ba5071cc5870b68a73 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Wed, 6 Jun 2018 12:39:26 +0800 Subject: [PATCH 07/52] Fix #843: Upload image on paste --- app/main.js | 2 ++ app/pasteManager.js | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 app/pasteManager.js diff --git a/app/main.js b/app/main.js index 353afa1a..d6ee9125 100644 --- a/app/main.js +++ b/app/main.js @@ -4,6 +4,7 @@ import app from './routes'; import locale from '../common/locales'; import fileManager from './fileManager'; import dragManager from './dragManager'; +import pasteManager from './pasteManager'; import { canHasSend } from './utils'; import storage from './storage'; import metrics from './metrics'; @@ -48,5 +49,6 @@ app.use(metrics); app.use(fileManager); app.use(dragManager); app.use(experiments); +app.use(pasteManager); app.mount('body'); diff --git a/app/pasteManager.js b/app/pasteManager.js new file mode 100644 index 00000000..ecae2476 --- /dev/null +++ b/app/pasteManager.js @@ -0,0 +1,24 @@ +/* global MAXFILESIZE */ +import { bytes } from './utils'; + +export default function(state, emitter) { + window.addEventListener('paste', event => { + if (state.route !== '/' || state.uploading) return; + + for (const item of event.clipboardData.items) { + if (!item.type.includes('image')) continue; + + const file = item.getAsFile(); + + if (!file) continue; // Sometimes null + + if (file.size > MAXFILESIZE) { + // eslint-disable-next-line no-alert + alert(state.translate('fileTooBig', { size: bytes(MAXFILESIZE) })); + continue; + } + + emitter.emit('upload', { file, type: 'paste' }); + } + }); +} From 11173c520bf22eb57a9398c5e1e53e4416303b08 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Thu, 7 Jun 2018 10:46:55 +0800 Subject: [PATCH 08/52] Add return to prevent multiple uploads --- app/pasteManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/pasteManager.js b/app/pasteManager.js index ecae2476..7fcaa1dc 100644 --- a/app/pasteManager.js +++ b/app/pasteManager.js @@ -19,6 +19,7 @@ export default function(state, emitter) { } emitter.emit('upload', { file, type: 'paste' }); + return; // return here since only one file is allowed to be uploaded at a time } }); } From f83784e033cb540f85be128f3c88ccb7c1aa89d1 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Wed, 13 Jun 2018 00:36:58 +0200 Subject: [PATCH 09/52] Scheduled weekly dependency update for week 23 (#849) * Update pytest from 3.6.0 to 3.6.1 * Update pytest-html from 1.18.0 to 1.19.0 --- test/integration/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/requirements.txt b/test/integration/requirements.txt index f93b1efb..c85e2d4d 100644 --- a/test/integration/requirements.txt +++ b/test/integration/requirements.txt @@ -2,7 +2,7 @@ selenium==3.12.0 flake8==3.5.0 flake8-isort==2.5 PyPOM==2.0.0 -pytest==3.6.0 -pytest-html==1.18.0 +pytest==3.6.1 +pytest-html==1.19.0 pytest-selenium==1.13.0 pytest-xdist==1.22.2 From e28a92848d614571b1c4b55bfd105165b9cbacf8 Mon Sep 17 00:00:00 2001 From: Vimal Raghubir Date: Fri, 15 Jun 2018 10:12:34 -0400 Subject: [PATCH 10/52] Remove bad role attribute --- app/templates/footer/index.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/templates/footer/index.js b/app/templates/footer/index.js index a0ad4de5..cfe94c55 100644 --- a/app/templates/footer/index.js +++ b/app/templates/footer/index.js @@ -6,8 +6,7 @@ module.exports = function(state) {
+ class="legalSection__link"> Terms of Service and Privacy Notice. You can learn more about this experiment and its data collection here. +legalNoticeMozilla = Use of the Firefox Send website is also subject to Mozilla’s Websites Privacy Notice and Websites Terms of Use. +deletePopupText = Delete this file? +deletePopupYes = Yes +deletePopupCancel = Cancel +deleteButtonHover = Delete +copyUrlHover = Copy URL +footerLinkLegal = Legal +# Test Pilot is a proper name and should not be localized. +footerLinkAbout = About Test Pilot +footerLinkPrivacy = Privacy +footerLinkTerms = Terms +footerLinkCookies = Cookies +requirePasswordCheckbox = Require a password to download this file +addPasswordButton = Add password +changePasswordButton = Change +passwordTryAgain = Incorrect password. Try again. +reportIPInfringement = Report IP Infringement +javascriptRequired = Firefox Send requires JavaScript +whyJavascript = Why does Firefox Send require JavaScript? +enableJavascript = Please enable JavaScript and try again. +# A short representation of a countdown timer containing the number of hours and minutes remaining as digits, example "13h 47m" +expiresHoursMinutes = { $hours }h { $minutes }m +# A short representation of a countdown timer containing the number of minutes remaining as digits, example "56m" +expiresMinutes = { $minutes }m +# A short status message shown when a password is successfully set +passwordIsSet = Password set +# A short status message shown when the user enters a long password +maxPasswordLength = Maximum password length: { $length } +# A short status message shown when there was an error setting the password +passwordSetError = This password could not be set From 42574af2cce89059a673c10801465340eee6ede9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Selim=20=C5=9Eumlu?= Date: Fri, 22 Jun 2018 11:33:08 +0000 Subject: [PATCH 44/52] Pontoon: Update Turkish (tr) localization of Test Pilot: Firefox Send MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Localization authors: - Selim Şumlu --- public/locales/tr/send.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales/tr/send.ftl b/public/locales/tr/send.ftl index 66a8b789..437edc2f 100644 --- a/public/locales/tr/send.ftl +++ b/public/locales/tr/send.ftl @@ -84,7 +84,7 @@ expiryFileList = Bitiş süresi deleteFileList = Sil nevermindButton = Boş ver legalHeader = Şart ve Koşullar -legalNoticeTestPilot = Firefox Send bir Test Pilotu deneyidir ve Test Pilotu Hizmet Koşulları ile Gizlilik Bildirimi’ne tabidir. Bu deney ve topladığı veriler hakkında daha fazla bilgi almak isterseniz buraya bakabilirsiniz. +legalNoticeTestPilot = Firefox Send bir Test Pilotu deneyidir ve Test Pilotu Hizmet Koşulları ile Gizlilik Bildirimi’ne tabidir. Bu deney ve topladığı veriler hakkında daha fazla bilgi almak isterseniz buraya bakabilirsiniz. legalNoticeMozilla = Firefox Send’i kullanmak Mozilla’nın Web Siteleri Gizlilik Bildirimi ve Web Siteleri Kullanım Koşulları’na da tabidir. deletePopupText = Bu dosya silinsin mi? deletePopupYes = Evet From dced61eb3029ebb861500a0ca8721c26b27872f5 Mon Sep 17 00:00:00 2001 From: Yongmin H Date: Mon, 25 Jun 2018 01:52:27 +0000 Subject: [PATCH 45/52] Pontoon: Update Korean (ko) localization of Test Pilot: Firefox Send Localization authors: - Yongmin H. --- public/locales/ko/send.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales/ko/send.ftl b/public/locales/ko/send.ftl index 7242b854..87a7b42f 100644 --- a/public/locales/ko/send.ftl +++ b/public/locales/ko/send.ftl @@ -18,7 +18,7 @@ verifyingFile = 확인하는 중… encryptingFile = 암호화 중… decryptingFile = 복호화 중… notifyUploadDone = 업로드가 완료되었습니다. -uploadingPageMessage = 파일이 업로드 되고나서 만료 옵션을 설정할 수 있습니다. +uploadingPageMessage = 파일이 업로드 되고 나서 만료 옵션을 설정할 수 있습니다. uploadingPageCancel = 업로드 취소 uploadCancelNotification = 업로드가 취소되었습니다. uploadingPageLargeFileMessage = 이 파일은 크기가 커서 시간이 다소 걸릴 수 있습니다. 잠시만 기다려주세요! From b3ad207326e59d16cd5fd57752ee0cb3bc8286c5 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 25 Jun 2018 19:19:15 +0200 Subject: [PATCH 46/52] Update pytest from 3.6.1 to 3.6.2 (#857) --- test/integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/requirements.txt b/test/integration/requirements.txt index c85e2d4d..de619d6d 100644 --- a/test/integration/requirements.txt +++ b/test/integration/requirements.txt @@ -2,7 +2,7 @@ selenium==3.12.0 flake8==3.5.0 flake8-isort==2.5 PyPOM==2.0.0 -pytest==3.6.1 +pytest==3.6.2 pytest-html==1.19.0 pytest-selenium==1.13.0 pytest-xdist==1.22.2 From 93072c0c1e252efc17c9a52b900a52f0c35489d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B0=B5=E0=B1=80=E0=B0=B5=E0=B1=86=E0=B0=A8=E0=B1=8D?= Date: Tue, 26 Jun 2018 16:12:41 +0000 Subject: [PATCH 47/52] Pontoon: Update Telugu (te) localization of Test Pilot: Firefox Send MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Localization authors: - వీవెన్ --- public/locales/te/send.ftl | 1 + 1 file changed, 1 insertion(+) diff --git a/public/locales/te/send.ftl b/public/locales/te/send.ftl index 2b7736cc..f57ad73f 100644 --- a/public/locales/te/send.ftl +++ b/public/locales/te/send.ftl @@ -7,6 +7,7 @@ uploadPageDropMessage = ఎగుమతిని ప్రారంభించ uploadPageSizeMessage = అత్యంత నమ్మకమైన కార్యం కోసం, మీ ఫైలును 1GB కంటే తక్కువగా ఉంచడం ఉత్తమం uploadPageBrowseButton = మీ కంప్యూటర్లో ఒక ఫైలును ఎంచుకోండి uploadPageBrowseButton1 = ఎక్కించటానికి ఒక ఫైలును ఎంచుకోండి +uploadPageMultipleFilesAlert = పలు ఫైళ్ళను లేదా సంయచాన్ని ఎక్కించడానికి ప్రస్తుతం తోడ్పాటు లేదు. uploadPageBrowseButtonTitle = ఫైలును ఎగుమతి చేయండి uploadingPageProgress = { $filename } ({ $size }) ఎక్కుతోంది importingFile = దిగుమతవుతోంది... From a74a560f0a8bde6c593529496f35b3a247208e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B0=B5=E0=B1=80=E0=B0=B5=E0=B1=86=E0=B0=A8=E0=B1=8D?= Date: Thu, 28 Jun 2018 10:15:36 +0000 Subject: [PATCH 48/52] Pontoon: Update Telugu (te) localization of Test Pilot: Firefox Send MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Localization authors: - వీవెన్ --- public/locales/te/send.ftl | 1 + 1 file changed, 1 insertion(+) diff --git a/public/locales/te/send.ftl b/public/locales/te/send.ftl index f57ad73f..acbc3923 100644 --- a/public/locales/te/send.ftl +++ b/public/locales/te/send.ftl @@ -65,6 +65,7 @@ errorAltText = ఎగుమతిలో లోపం errorPageHeader = ఏదో తప్పిదం జరిగింది! errorPageMessage = ఫైల్ను ఎగుమతి చేయడంలో లోపం ఉంది. errorPageLink = మరో ఫైలును పంపండి +fileTooBig = ఆ ఫైలు ఎక్కించడానికి చాలా పెద్దగా ఉంది. ఫైళ్ళు { $size } కంటే తక్కువ పరిమాణంలో ఉండాలి. linkExpiredAlt = లంకె గడువు ముగిసింది expiredPageHeader = ఈ లంకె గడువు ముగిసింది లేదా ముందు ఎప్పుడూ ఉనికిలో లేదు! notSupportedHeader = మీ విహారిణికి మద్దతు లేదు. From 7e30fe8d33e07b73240660093ead80ab288971b5 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 9 Jul 2018 21:55:57 +0200 Subject: [PATCH 49/52] Scheduled weekly dependency update for week 27 (#861) * Update selenium from 3.12.0 to 3.13.0 * Update pytest from 3.6.2 to 3.6.3 --- test/integration/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/requirements.txt b/test/integration/requirements.txt index de619d6d..0b089ab2 100644 --- a/test/integration/requirements.txt +++ b/test/integration/requirements.txt @@ -1,8 +1,8 @@ -selenium==3.12.0 +selenium==3.13.0 flake8==3.5.0 flake8-isort==2.5 PyPOM==2.0.0 -pytest==3.6.2 +pytest==3.6.3 pytest-html==1.19.0 pytest-selenium==1.13.0 pytest-xdist==1.22.2 From dfea1e96fb472e5b4a427a9bb223b4ab84003989 Mon Sep 17 00:00:00 2001 From: avelper Date: Tue, 10 Jul 2018 21:33:30 +0000 Subject: [PATCH 50/52] Pontoon: Update Spanish (Spain) (es-ES) localization of Test Pilot: Firefox Send Localization authors: - avelper - jesferman1993 --- public/locales/es-ES/send.ftl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/locales/es-ES/send.ftl b/public/locales/es-ES/send.ftl index c9bc57ae..bf289015 100644 --- a/public/locales/es-ES/send.ftl +++ b/public/locales/es-ES/send.ftl @@ -12,7 +12,7 @@ uploadPageBrowseButton1 = Seleccionar un archivo para subir uploadPageMultipleFilesAlert = Aún no se pueden subir varios archivos o una carpeta. uploadPageBrowseButtonTitle = Subir archivo uploadingPageProgress = Subiendo { $filename } ({ $size }) -importingFile = Imporando... +importingFile = Importando... verifyingFile = Comprobando... encryptingFile = Encriptando... decryptingFile = Desencriptando... @@ -88,7 +88,7 @@ expiryFileList = Caduca en deleteFileList = Eliminar nevermindButton = Da igual legalHeader = Términos y privacidad -legalNoticeTestPilot = Firefox Send sigue siendo un experimento de Test Pilot y está sujero a las Condiciones del servicio y al Aviso de privacidad de Test Pilot. +legalNoticeTestPilot = Firefox Send sigue siendo un experimento de Test Pilot y está sujero a las Condiciones del servicio y al Aviso de privacidad de Test Pilot. Aquí podrás descubrir más sobre este experimento y su recopilación de datos. legalNoticeMozilla = El uso de la página de Firefox Send también está sujeto al Aviso de privacidad sobre sitios web y a los Términos de uso sobre sitios web. deletePopupText = ¿Eliminar el archivo? deletePopupYes = Sí From 5ff92c64529de99ed19858ec3e7eb06db4700710 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 12 Jul 2018 14:00:22 -0700 Subject: [PATCH 51/52] fix cancelled downloads increasing count --- server/routes/download.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/routes/download.js b/server/routes/download.js index b320d899..8fe177c7 100644 --- a/server/routes/download.js +++ b/server/routes/download.js @@ -15,9 +15,14 @@ module.exports = async function(req, res) { }); const file_stream = storage.get(id); let sentBytes = 0; + let cancelled = false; + + req.on('close', () => (cancelled = true)); + file_stream.on('data', c => (sentBytes += c.length)); + file_stream.on('end', async () => { - if (sentBytes < contentLength) { + if (cancelled) { return; } const dl = meta.dl + 1; @@ -32,6 +37,7 @@ module.exports = async function(req, res) { log.info('StorageError:', id); } }); + file_stream.pipe(res); } catch (e) { res.sendStatus(404); From 527e9f09c9b83f9cdac868bf9fc100d06042db94 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 12 Jul 2018 16:07:18 -0700 Subject: [PATCH 52/52] add a test --- app/api.js | 3 +++ server/routes/download.js | 10 +++++----- test/frontend/tests/workflow-tests.js | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/app/api.js b/app/api.js index e314657d..7d9fb394 100644 --- a/app/api.js +++ b/app/api.js @@ -160,6 +160,7 @@ function download(id, keychain, onprogress, canceller) { resolve(this.result); }; }); + xhr.addEventListener('progress', function(event) { if (event.lengthComputable && event.target.status === 200) { onprogress([event.loaded, event.total]); @@ -168,8 +169,10 @@ function download(id, keychain, onprogress, canceller) { const auth = await keychain.authHeader(); xhr.open('get', `/api/download/${id}`); xhr.setRequestHeader('Authorization', auth); + xhr.setRequestHeader('Connection', 'close'); xhr.responseType = 'blob'; xhr.send(); + onprogress([0, 1]); }); } diff --git a/server/routes/download.js b/server/routes/download.js index 8fe177c7..84ba715d 100644 --- a/server/routes/download.js +++ b/server/routes/download.js @@ -14,14 +14,14 @@ module.exports = async function(req, res) { 'WWW-Authenticate': `send-v1 ${req.nonce}` }); const file_stream = storage.get(id); - let sentBytes = 0; let cancelled = false; - req.on('close', () => (cancelled = true)); + req.on('close', () => { + cancelled = true; + file_stream.destroy(); + }); - file_stream.on('data', c => (sentBytes += c.length)); - - file_stream.on('end', async () => { + file_stream.on('close', async () => { if (cancelled) { return; } diff --git a/test/frontend/tests/workflow-tests.js b/test/frontend/tests/workflow-tests.js index 23bc8efc..69eba9dd 100644 --- a/test/frontend/tests/workflow-tests.js +++ b/test/frontend/tests/workflow-tests.js @@ -134,6 +134,27 @@ describe('Upload / Download flow', function() { } }); + it('can cancel and not increase download count', async function() { + const fs = new FileSender(blob); + const file = await fs.upload(); + const fr = new FileReceiver({ + secretKey: file.toJSON().secretKey, + id: file.id, + nonce: file.keychain.nonce, + requiresPassword: false + }); + await fr.getMetadata(); + fr.once('progress', () => fr.cancel()); + + try { + await fr.download(noSave); + assert.fail('not cancelled'); + } catch (e) { + await file.updateDownloadCount(); + assert.equal(file.dtotal, 0); + } + }); + it('can allow multiple downloads', async function() { const fs = new FileSender(blob); const file = await fs.upload();