mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-30 11:42:26 +08:00
fixes
This commit is contained in:
parent
d937c754fb
commit
90688a9b59
12
compare.js
12
compare.js
@ -25,6 +25,14 @@ function checkMissing(table, name, ids1, ids2) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleBuffer(obj) {
|
||||||
|
if (obj && Buffer.isBuffer(obj.content)) {
|
||||||
|
obj.content = obj.content.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
function compareRows(table, rsLeft, rsRight, column) {
|
function compareRows(table, rsLeft, rsRight, column) {
|
||||||
const leftIds = Object.keys(rsLeft);
|
const leftIds = Object.keys(rsLeft);
|
||||||
const rightIds = Object.keys(rsRight);
|
const rightIds = Object.keys(rsRight);
|
||||||
@ -37,8 +45,8 @@ function compareRows(table, rsLeft, rsRight, column) {
|
|||||||
const commonIds = leftIds.filter(item => rightIds.includes(item));
|
const commonIds = leftIds.filter(item => rightIds.includes(item));
|
||||||
|
|
||||||
for (const id of commonIds) {
|
for (const id of commonIds) {
|
||||||
const valueLeft = Buffer.isBuffer(rsLeft[id]) ? rsLeft[id].toString() : rsLeft[id];
|
const valueLeft = handleBuffer(rsLeft[id]);
|
||||||
const valueRight = Buffer.isBuffer(rsRight[id]) ? rsRight[id].toString() : rsRight[id];
|
const valueRight = handleBuffer(rsRight[id]);
|
||||||
|
|
||||||
const left = JSON.stringify(valueLeft, null, 2);
|
const left = JSON.stringify(valueLeft, null, 2);
|
||||||
const right = JSON.stringify(valueRight, null, 2);
|
const right = JSON.stringify(valueRight, null, 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user