Commit a1fdd6f43395d2a208100cc07a2769a1b684bedf
fix: fail gracefully on jpeg rotation exception
Stephen Whitmore committed on 12/28/2017, 7:41:15 PMParent: c5a95cc1ebe6dd3a4d572220f5cd60c31381de97
Files changed
lib/serve.js | changed |
lib/serve.js | |||
---|---|---|---|
@@ -1209,17 +1209,22 @@ | |||
1209 | 1209 … | function onFullBuffer (err, buffer) { | |
1210 | 1210 … | if (err) return heresTheData(err) | |
1211 | 1211 … | buffer = Buffer.concat(buffer) | |
1212 | 1212 … | ||
1213 | - jpeg.rotate(buffer, {}, function (err, rotatedBuffer, orientation) { | ||
1214 | - if (!err) buffer = rotatedBuffer | ||
1213 … | + try { | ||
1214 … | + jpeg.rotate(buffer, {}, function (err, rotatedBuffer, orientation) { | ||
1215 … | + if (!err) buffer = rotatedBuffer | ||
1215 | 1216 … | ||
1216 | - heresTheData(null, buffer) | ||
1217 | - pull( | ||
1218 | - pull.once(buffer), | ||
1219 | - self.respondSink() | ||
1220 | - ) | ||
1221 | - }) | ||
1217 … | + heresTheData(null, buffer) | ||
1218 … | + pull( | ||
1219 … | + pull.once(buffer), | ||
1220 … | + self.respondSink() | ||
1221 … | + ) | ||
1222 … | + }) | ||
1223 … | + } catch (err) { | ||
1224 … | + console.trace(err) | ||
1225 … | + self.respond(500, err.message || err) | ||
1226 … | + } | ||
1222 | 1227 … | } | |
1223 | 1228 … | ||
1224 | 1229 … | done(function (err, data, type) { | |
1225 | 1230 … | if (err) { |
Built with git-ssb-web