Skip to content

Commit

Permalink
Fixed #24, JSON couldnt be created when reserved characters are involved
Browse files Browse the repository at this point in the history
Bumped version
  • Loading branch information
Xzandro committed Mar 26, 2017
1 parent 653f780 commit 5128f17
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/plugins/friend-export.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs');
const path = require('path');
const eol = require('os').EOL;
const sanitize = require("sanitize-filename");

module.exports = {
defaultConfig: {
Expand All @@ -24,7 +25,7 @@ module.exports = {
writeProfileToFile(proxy, req, resp) {
const wizard_id = resp.friend.wizard_id;
const wizard_name = resp.friend.wizard_name;
const filename = `${wizard_name}-${wizard_id}-visit.json`;
const filename = sanitize(`${wizard_name}|.-${wizard_id}`).concat('-visit.json');

var outFile = fs.createWriteStream(
path.join(config.Config.App.filesPath, filename), {
Expand Down
3 changes: 2 additions & 1 deletion app/plugins/profile-export.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs');
const path = require('path');
const eol = require('os').EOL;
const sanitize = require("sanitize-filename");

module.exports = {
defaultConfig: {
Expand All @@ -24,7 +25,7 @@ module.exports = {
writeProfileToFile(proxy, req, resp) {
const wizard_id = resp.wizard_info.wizard_id;
const wizard_name = resp.wizard_info.wizard_name;
const filename = `${wizard_name}-${wizard_id}.json`;
const filename = sanitize(`${wizard_name}-${wizard_id}`).concat('.json');

var outFile = fs.createWriteStream(
path.join(config.Config.App.filesPath, filename), {
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sw-exporter",
"productName": "Summoners War Exporter",
"version": "0.0.10",
"version": "0.0.11",
"description": "This tool will parse intercepted data from Summoners War and extract information on the monsters and runes of the user.",
"main": "./app/main.js",
"scripts": {
Expand All @@ -17,7 +17,8 @@
"appId": "com.electron.sw-exporter",
"win": {
"target": [
"zip", "portable"
"zip",
"portable"
]
}
},
Expand Down Expand Up @@ -50,6 +51,7 @@
"react-dom": "^15.4.2",
"react-router": "^3.0.2",
"request": "^2.81.0",
"sanitize-filename": "^1.6.1",
"semantic-ui-react": "^0.67.1"
}
}

0 comments on commit 5128f17

Please sign in to comment.