git ssb

16+

cel / patchfoo



Commit a1fdd6f43395d2a208100cc07a2769a1b684bedf

fix: fail gracefully on jpeg rotation exception

Stephen Whitmore committed on 12/28/2017, 7:41:15 PM
Parent: c5a95cc1ebe6dd3a4d572220f5cd60c31381de97

Files changed

lib/serve.jschanged
lib/serve.jsView
@@ -1209,17 +1209,22 @@
12091209 function onFullBuffer (err, buffer) {
12101210 if (err) return heresTheData(err)
12111211 buffer = Buffer.concat(buffer)
12121212
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
12151216
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 + }
12221227 }
12231228
12241229 done(function (err, data, type) {
12251230 if (err) {

Built with git-ssb-web