From 3e897727ca7c8b0b5ba11c9d1866dc87ea136c22 Mon Sep 17 00:00:00 2001 From: sei0o inoue Date: Sun, 7 Oct 2018 16:51:46 +0900 Subject: Fix #2773 (#2841) * Added an API endpoint to check the existence of the file * fix #2773: Now we can prevent users from posting the same images * bug fix --- src/client/app/common/scripts/get-md5.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/client/app/common/scripts/get-md5.ts (limited to 'src/client/app/common/scripts') diff --git a/src/client/app/common/scripts/get-md5.ts b/src/client/app/common/scripts/get-md5.ts new file mode 100644 index 0000000000..24ac04c1ad --- /dev/null +++ b/src/client/app/common/scripts/get-md5.ts @@ -0,0 +1,8 @@ +const crypto = require('crypto'); + +export default (data: ArrayBuffer) => { + const buf = new Buffer(data); + const hash = crypto.createHash("md5"); + hash.update(buf); + return hash.digest("hex"); +}; \ No newline at end of file -- cgit v1.2.3-freya