From ccc33db9ddbd02a588bcf1624228fb33c213873a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 18 Apr 2017 17:23:34 +0100 Subject: [PATCH] Compress uploaded rageshakes. (#3647) --- package.json | 1 + src/vector/submit-rageshake.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 62b1f134..0ad3c33b 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", "modernizr": "^3.1.0", + "pako": "^1.0.5", "q": "^1.4.1", "react": "^15.4.0", "react-dnd": "^2.1.4", diff --git a/src/vector/submit-rageshake.js b/src/vector/submit-rageshake.js index 6ed49a1f..ef6fbabe 100644 --- a/src/vector/submit-rageshake.js +++ b/src/vector/submit-rageshake.js @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ +import pako from 'pako'; import q from "q"; import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg'; @@ -78,7 +79,10 @@ export default async function sendBugReport(bugReportEndpoint, opts) { // encode as UTF-8 const buf = new TextEncoder().encode(entry.lines); - body.append('log', new Blob([buf]), entry.id); + // compress + const compressed = pako.gzip(buf); + + body.append('compressed-log', new Blob([compressed]), entry.id); } }