Use .slice() to get rid of leading and trailing double quotes for values going into DB, closes issue #7
This commit is contained in:
parent
b5e874235e
commit
6f856f006c
@ -111,11 +111,11 @@ app.post('/', function(req, res){
|
||||
var innerDataJSON = JSON.parse(req.body.data);
|
||||
var status = JSON.stringify(innerDataJSON.status, null, 4);
|
||||
var stmt = db.prepare("INSERT INTO Alerts (OrigJSON, coreid, published_at, status) VALUES (?, ?, ?, ?)");
|
||||
stmt.run(
|
||||
stmt.run( // Use .slice to get rid of leading and trailing double quotes.
|
||||
JSON.stringify(req.body, null, 4),
|
||||
JSON.stringify(req.body.coreid, null, 4),
|
||||
JSON.stringify(req.body.published_at, null, 4),
|
||||
status
|
||||
JSON.stringify(req.body.coreid, null, 4).slice(1,-1),
|
||||
JSON.stringify(req.body.published_at, null, 4).slice(1,-1),
|
||||
status.slice(1,-1)
|
||||
);
|
||||
stmt.finalize();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user