Test gh app#4
Conversation
|
|
||
| function validate_marker_post (fields, file, res) { | ||
|
|
||
| console.log('validating photo'); |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| console.log('validating photo'); | |
| console.log("validating photo"); |
| initPassport(passport); | ||
|
|
||
| // Allow index router to handle all incoming requests | ||
| var routes = require('./routes/index')(passport); |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| var routes = require('./routes/index')(passport); | |
| var routes = require("./routes/index")(passport); |
| if (tags) { | ||
|
|
||
| // Update marker data | ||
| Marker.findOne({'_id': marker_id}, function (err, marker) { |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| Marker.findOne({'_id': marker_id}, function (err, marker) { | |
| Marker.findOne({"_id": marker_id}, function (err, marker) { |
| reads = [], | ||
| ids; | ||
|
|
||
| console.log('photo requests: ' + JSON.stringify(markers)); |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| console.log('photo requests: ' + JSON.stringify(markers)); | |
| console.log("photo requests: " + JSON.stringify(markers)); |
| } | ||
|
|
||
| // respond with json | ||
| if (req.accepts('json')) { |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| if (req.accepts('json')) { | |
| if (req.accepts("json")) { |
| _ = require("underscore"), | ||
| fs = require('fs'), | ||
| formidable = require('formidable'), | ||
| crypto = require('crypto'), |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| crypto = require('crypto'), | |
| crypto = require("crypto"), |
| } else if (err.code === 11000) { | ||
| return res.status(422).json({message: 'Image file already exists. Duplicate images are not allowed.'}); | ||
| } else { | ||
| return res.status(500).json({message: 'An internal error occurred'}); |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| return res.status(500).json({message: 'An internal error occurred'}); | |
| return res.status(500).json({message: "An internal error occurred"}); |
| reads.push(read.promise); | ||
| console.log('err code: ' + err.code); | ||
| if (err.code === 16755) { | ||
| return res.status(422).json({message: 'Latitude and longitude are not geographically valid.'}); |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| return res.status(422).json({message: 'Latitude and longitude are not geographically valid.'}); | |
| return res.status(422).json({message: "Latitude and longitude are not geographically valid."}); |
| // Loop over each size for this marker | ||
| sizes.forEach((size) => { | ||
| if (err) { | ||
| console.log('Error in saving marker: ' + err); |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| console.log('Error in saving marker: ' + err); | |
| console.log("Error in saving marker: " + err); |
| console.log('photo requests: ' + JSON.stringify(markers)); | ||
|
|
||
| if (!markers) { | ||
| console.log('invalid data for get_photo_b64'); |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| console.log('invalid data for get_photo_b64'); | |
| console.log("invalid data for get_photo_b64"); |
|
|
||
| // Make sure user is authorized to see/edit this marker | ||
| if (!marker.user_id.equals(req.user._id)) { | ||
| return res.status(403).json({message: 'You are not authorized to view this marker'}); |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| return res.status(403).json({message: 'You are not authorized to view this marker'}); | |
| return res.status(403).json({message: "You are not authorized to view this marker"}); |
| if (page_index >= 0) { | ||
| query.skip(page_index * res_per_page); | ||
| } else { | ||
| console.log('invalid page value'); |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| console.log('invalid page value'); | |
| console.log("invalid page value"); |
| ['', '_md', '_sm'].forEach((suffix) => { | ||
|
|
||
| const photo = marker._id.toString() + suffix + '.jpg'; | ||
| const existing_path = __dirname + '/public/photos/' + photo; |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| const existing_path = __dirname + '/public/photos/' + photo; | |
| const existing_path = __dirname + "/public/photos/" + photo; |
| } | ||
|
|
||
| function handle_marker_data_failure () { | ||
| console.log('marker data failure'); |
There was a problem hiding this comment.
Codacy has a fix for the issue: Strings must use doublequote.
| console.log('marker data failure'); | |
| console.log("marker data failure"); |
No description provided.