From 20f9b5aa82d610f379436c76d9d1d1541a6542a3 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Sat, 18 Aug 2018 11:56:57 -0700 Subject: [PATCH] decoding from local storage bug fix --- components/Editor.js | 4 +++- lib/util.js | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/Editor.js b/components/Editor.js index a2ca44b..b749f8f 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -99,7 +99,9 @@ class Editor extends React.Component { } // Makes sure the slash in encoded in application/X is decoded - newState.language = unescapeHtml(newState.language) + if (newState.language) { + newState.language = unescapeHtml(newState.language) + } this.setState(newState) diff --git a/lib/util.js b/lib/util.js index a4435a4..1f80ffe 100644 --- a/lib/util.js +++ b/lib/util.js @@ -20,7 +20,6 @@ export const escapeHtml = s => { .replace(//g, '>') .replace(/\//g, '/') - .replace(/&/g, '&') } } @@ -30,7 +29,6 @@ export const unescapeHtml = s => { .replace(/</g, '<') .replace(/>/g, '>') .replace(///g, '/') - .replace(/&/g, '&'); } }