mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
Revert previous changes and save hash to new field sha256
This commit is contained in:
parent
2ad3121494
commit
4771cc9575
@ -18,6 +18,10 @@
|
||||
"configurable": false,
|
||||
"required": true
|
||||
},
|
||||
"sha256": {
|
||||
"type": "string",
|
||||
"configurable": false
|
||||
},
|
||||
"ext": {
|
||||
"type": "string",
|
||||
"configurable": false
|
||||
@ -48,4 +52,4 @@
|
||||
"configurable": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,7 @@ const fs = require('fs');
|
||||
const _ = require('lodash');
|
||||
const toArray = require('stream-to-array');
|
||||
const crypto = require('crypto');
|
||||
const uuid = require('uuid/v4');
|
||||
|
||||
function niceHash(buffer) {
|
||||
return crypto.createHash('sha256')
|
||||
@ -41,7 +42,8 @@ module.exports = {
|
||||
|
||||
return {
|
||||
name: stream.name,
|
||||
hash: niceHash(buffer),
|
||||
sha256: niceHash(buffer),
|
||||
hash: uuid().replace(/-/g, ''),
|
||||
ext: stream.name.split('.').length > 1 ? `.${_.last(stream.name.split('.'))}` : '',
|
||||
buffer,
|
||||
mime: stream.type,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user