Skip to content

Commit 98eb424

Browse files
committed
Resolve #12
1 parent b9689aa commit 98eb424

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

libs/Datastore/requests.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ export async function getBody(id, jotType, abortController) {
7171
.authorize()
7272
.makeRequest(abortController);
7373

74-
return unescapeSlashes(await response.data.body);
74+
const body = await response.data.body;
75+
const unescapedSlashes = unescapeSlashes(body);
76+
77+
return unescapedSlashes;
7578
}
7679

7780
export async function updateBody(id, jotType, newBody, abortController) {

libs/Datastore/responseHelpers.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,8 @@ import { useEffect } from "react";
88
export function unescapeSlashes(str) {
99
// Adds another escaped slash if the string ends with an odd number of escaped slashes
1010
// because an odd number crashes the JSON.parse
11-
let parsedStr = str.replace(/(^|[^\\])(\\\\)*\\$/, "$&\\");
12-
parsedStr = str.replace(/(\\)(\')+/, /\'/);
13-
14-
try {
15-
parsedStr = JSON.parse(`"${parsedStr}"`);
16-
} catch (e) {
17-
return str;
18-
}
11+
let parsedStr = str.replace(/\\'/gm, `'`);
12+
parsedStr = parsedStr.replace(/\\n/gm, `\n`);
1913

2014
return parsedStr;
2115
}

libs/browser.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export default class Browser {
4444
}
4545

4646
browserSupported() {
47-
console.log(this.browser);
4847
if (["Firefox", "Edge", "Edge or Chrome"].includes(this.browser)) return true;
4948

5049
return false;

0 commit comments

Comments
 (0)