Skip to content

Commit 5128f17

Browse files
committed
Fixed #24, JSON couldnt be created when reserved characters are involved
Bumped version
1 parent 653f780 commit 5128f17

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

app/plugins/friend-export.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const fs = require('fs');
22
const path = require('path');
33
const eol = require('os').EOL;
4+
const sanitize = require("sanitize-filename");
45

56
module.exports = {
67
defaultConfig: {
@@ -24,7 +25,7 @@ module.exports = {
2425
writeProfileToFile(proxy, req, resp) {
2526
const wizard_id = resp.friend.wizard_id;
2627
const wizard_name = resp.friend.wizard_name;
27-
const filename = `${wizard_name}-${wizard_id}-visit.json`;
28+
const filename = sanitize(`${wizard_name}|.-${wizard_id}`).concat('-visit.json');
2829

2930
var outFile = fs.createWriteStream(
3031
path.join(config.Config.App.filesPath, filename), {

app/plugins/profile-export.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const fs = require('fs');
22
const path = require('path');
33
const eol = require('os').EOL;
4+
const sanitize = require("sanitize-filename");
45

56
module.exports = {
67
defaultConfig: {
@@ -24,7 +25,7 @@ module.exports = {
2425
writeProfileToFile(proxy, req, resp) {
2526
const wizard_id = resp.wizard_info.wizard_id;
2627
const wizard_name = resp.wizard_info.wizard_name;
27-
const filename = `${wizard_name}-${wizard_id}.json`;
28+
const filename = sanitize(`${wizard_name}-${wizard_id}`).concat('.json');
2829

2930
var outFile = fs.createWriteStream(
3031
path.join(config.Config.App.filesPath, filename), {

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sw-exporter",
33
"productName": "Summoners War Exporter",
4-
"version": "0.0.10",
4+
"version": "0.0.11",
55
"description": "This tool will parse intercepted data from Summoners War and extract information on the monsters and runes of the user.",
66
"main": "./app/main.js",
77
"scripts": {
@@ -17,7 +17,8 @@
1717
"appId": "com.electron.sw-exporter",
1818
"win": {
1919
"target": [
20-
"zip", "portable"
20+
"zip",
21+
"portable"
2122
]
2223
}
2324
},
@@ -50,6 +51,7 @@
5051
"react-dom": "^15.4.2",
5152
"react-router": "^3.0.2",
5253
"request": "^2.81.0",
54+
"sanitize-filename": "^1.6.1",
5355
"semantic-ui-react": "^0.67.1"
5456
}
5557
}

0 commit comments

Comments
 (0)