Permalink
Browse files

don't do request for image if options are invalid

  • Loading branch information...
1 parent 0f62dc2 commit 16ec3222ae364c440a42500fbcfa5e520c051f05 @kcivey kcivey committed Nov 12, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 server.js
View
@@ -21,12 +21,13 @@ app.get(/^(\/.+)\.([^.\/]+)(\.jpe?g)$/i, function (req, res) {
var convertOptions = getConvertOptions(req.params[1]),
relativePath = req.params[0] + req.params[2],
source = basePath + relativePath,
- r = request(source),
- times = {start: Date.now()};
+ times = {start: Date.now()},
+ r;
if (!convertOptions) {
res.send(400);
return;
}
+ r = request(source);
r.on('response', function (remoteRes) {
var maxAge, m, rawFile, convertedFile, stream;
if (remoteRes.statusCode === 200) {

0 comments on commit 16ec322

Please sign in to comment.