|
@@ -102,7 +102,8 @@ module.exports.createZip = createZip
|
|
|
|
|
|
const download = require('download')
|
|
|
async function downloadUrl(url) {
|
|
|
- let filename = path.basename(url)
|
|
|
+ let md5 = crypto.createHash('md5');
|
|
|
+ let filename = md5.update(url).digest('hex') + path.extname(url)
|
|
|
let filepath = path.join(tempDir,filename)
|
|
|
// console.log(filename,filepath)
|
|
|
try{
|
|
@@ -139,7 +140,7 @@ async function downloadUrl(url) {
|
|
|
}
|
|
|
merge = true;
|
|
|
}
|
|
|
-
|
|
|
+ // console.log("merge",filePathList)
|
|
|
try {
|
|
|
let docxBuffer = fs.readFileSync(docxPath);
|
|
|
|
|
@@ -302,4 +303,11 @@ export function replaceDocx(inputDocxPath, outputDocxPath, options,eventMap) {
|
|
|
|
|
|
}
|
|
|
|
|
|
-module.exports.replaceDocx = replaceDocx
|
|
|
+module.exports.replaceDocx = replaceDocx
|
|
|
+function generateObjectId(inputString) {
|
|
|
+ inputString = inputString || ""
|
|
|
+ inputString = String(inputString)
|
|
|
+ const hash = crypto.createHash('sha256').update(inputString).digest('hex');
|
|
|
+ const objectId = hash;
|
|
|
+ return objectId;
|
|
|
+}
|