mirror of
https://github.com/laurent22/joplin.git
synced 2026-06-18 20:16:34 +02:00
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# Resolves an issue in which notes and attachments larger than 16 KB
|
||||
# could become corrupted during the upload process.
|
||||
# See https://github.com/laurent22/joplin/issues/14343
|
||||
diff --git a/src/parsers/JSON.js b/src/parsers/JSON.js
|
||||
index 9a096c25778c7c68be1ddd9dd78faa85bd1d8ec3..6d6bfd2d3789313a7adc8966ab8e58c3d3167356 100644
|
||||
--- a/src/parsers/JSON.js
|
||||
+++ b/src/parsers/JSON.js
|
||||
@@ -12,13 +12,14 @@ class JSONParser extends Transform {
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
- this.chunks.push(String(chunk)); // todo consider using a string decoder
|
||||
+ this.chunks.push(chunk); // type: Uint8Array
|
||||
callback();
|
||||
}
|
||||
|
||||
_flush(callback) {
|
||||
try {
|
||||
- const fields = JSON.parse(this.chunks.join(''));
|
||||
+ const data = Buffer.concat(this.chunks);
|
||||
+ const fields = JSON.parse(data.toString('utf-8'));
|
||||
Object.keys(fields).forEach((key) => {
|
||||
const value = fields[key];
|
||||
this.push({ key, value });
|
||||
Reference in New Issue
Block a user