From 668659b2330410077f31ccd3becd56e45e0b10b1 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Fri, 22 Dec 2017 03:46:46 +0200 Subject: [PATCH] Use SHA256 for cache filenames, camelCase function --- lib/preview.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/preview.js b/lib/preview.js index 14a738a..c2a67ad 100644 --- a/lib/preview.js +++ b/lib/preview.js @@ -4,7 +4,7 @@ import fs from 'fs-extra' const engines = [ require('./preview/image'), require('./preview/ffmpeg'), require('./preview/unoconv') ] -const cache_name = file => crypto.createHash('sha1').update(file.fullpath).digest('hex') +const cacheName = file => crypto.createHash('sha256').update(file.fullpath).digest('hex') module.exports = (files, cache_path) => { @@ -15,7 +15,7 @@ module.exports = (files, cache_path) => { const preview = async file => { const p = engines.find(p => p.preview && p.detect(file)) if (p) { - const dest = path.join(cache_path, cache_name(file)) + '.' + p.ext(file) + const dest = path.join(cache_path, cacheName(file)) + '.' + p.ext(file) if (!await fs.pathExists(dest)) await p.preview(file.fullpath, dest) return dest }