diff --git a/client/src/components/Camera.js b/client/src/components/Camera.js index e7c11f0..c691b2e 100644 --- a/client/src/components/Camera.js +++ b/client/src/components/Camera.js @@ -57,7 +57,6 @@ class Camera extends React.Component { ) storePicture(this.canvas.toDataURL('image/jpeg', true)) .then(picture => { - console.log(picture) this.props.addPicture(picture) this.clearTakingPicture() videoStream.getTracks()[0].stop() diff --git a/client/src/containers/Toad.js b/client/src/containers/Toad.js index aeda698..ffb1d10 100644 --- a/client/src/containers/Toad.js +++ b/client/src/containers/Toad.js @@ -79,7 +79,11 @@ class Toad extends Component { loadPicture(data.sha).then(picture => { picture && connection.send(response(data.sha, picture)) }) - } else if (data.response && checkPicture(data.picture, data.sha)) { + } else if (data.response) { + const pictureValid = checkPicture(data.picture, data.sha) + if (!pictureValid) { + return console.error('invalid picture received') + } const index = this.state.list.indexOf(data.sha) this.setState(state => { state.pictures[index] = data.picture diff --git a/client/src/store.js b/client/src/store.js index f613a0b..d24a19d 100644 --- a/client/src/store.js +++ b/client/src/store.js @@ -14,7 +14,7 @@ const loadPicture = sha => localforage.getItem(sha) const checkPicture = (picture, sha) => - shasum(picture) === sha + shasum(picture).toString() === sha module.exports = { storePicture,