Skip to content

Commit

Permalink
[slideshow] fix id length validation
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Jul 2, 2011
1 parent 1e7c532 commit 5bc2cfa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/slides/slideshow.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ slideshow.init = function(Slideshow, Slide, server) {
// Add get static method
Slideshow.static({
get: function(req, res, callback) {

if (!req.params.slideshow) return res.json(404);

var Slideshow = mongoose.model('Slideshow');
var Slideshow = mongoose.model('Slideshow'),
validId = req.params.slideshow.length <= 12;

if (!callback && typeof res === 'function') {
callback = res;

if (req.params.slideshow <= 12) {
if (validId) {
Slideshow.findById(req.params.slideshow);
} else {
onResult(null, null);
Expand All @@ -70,7 +70,7 @@ slideshow.init = function(Slideshow, Slide, server) {
return;
}

if (req.params.slideshow <= 12) {
if (validId) {
Slideshow.findById(req.params.slideshow, onSecondResult);
} else {
onSecondResult(null, null);
Expand Down

0 comments on commit 5bc2cfa

Please sign in to comment.