mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 11:32:39 +00:00
Merge pull request #4347 from G-Ambatte/experimentalDiffSaveFix
Diff patching fix using encodeURI
This commit is contained in:
@@ -266,7 +266,7 @@ const EditPage = createClass({
|
|||||||
brew.text = brew.text.normalize('NFC');
|
brew.text = brew.text.normalize('NFC');
|
||||||
this.savedBrew.text = this.savedBrew.text.normalize('NFC');
|
this.savedBrew.text = this.savedBrew.text.normalize('NFC');
|
||||||
brew.pageCount = ((brew.renderer=='legacy' ? brew.text.match(/\\page/g) : brew.text.match(/^\\page$/gm)) || []).length + 1;
|
brew.pageCount = ((brew.renderer=='legacy' ? brew.text.match(/\\page/g) : brew.text.match(/^\\page$/gm)) || []).length + 1;
|
||||||
brew.patches = stringifyPatches(makePatches(this.savedBrew.text, brew.text));
|
brew.patches = stringifyPatches(makePatches(encodeURI(this.savedBrew.text), encodeURI(brew.text)));
|
||||||
brew.hash = await md5(this.savedBrew.text);
|
brew.hash = await md5(this.savedBrew.text);
|
||||||
//brew.text = undefined; - Temporary parallel path
|
//brew.text = undefined; - Temporary parallel path
|
||||||
brew.textBin = undefined;
|
brew.textBin = undefined;
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ const api = {
|
|||||||
try {
|
try {
|
||||||
const patches = parsePatch(brewFromClient.patches);
|
const patches = parsePatch(brewFromClient.patches);
|
||||||
// Patch to a throwaway variable while parallelizing - we're more concerned with error/no error.
|
// Patch to a throwaway variable while parallelizing - we're more concerned with error/no error.
|
||||||
const patchedResult = applyPatches(patches, brewFromServer.text, { allowExceedingIndices: true })[0];
|
const patchedResult = decodeURI(applyPatches(patches, encodeURI(brewFromServer.text))[0]);
|
||||||
if(patchedResult != brewFromClient.text)
|
if(patchedResult != brewFromClient.text)
|
||||||
throw("Patches did not apply cleanly, text mismatch detected");
|
throw("Patches did not apply cleanly, text mismatch detected");
|
||||||
// brew.text = applyPatches(patches, brewFromServer.text)[0];
|
// brew.text = applyPatches(patches, brewFromServer.text)[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user