Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
killagu committed Sep 22, 2024
1 parent 782b468 commit 08f16a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions commands/upload_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ console.warn = function() { };

async function gzipFile(filePath) {
// 避免文件同名,对原路径取 md5 哈希作为新文件名
const fileName = crypto.createHash('md5').update(filePath).digest('hex');
const gzippedFile = path.join(utils.getXtransitPath(), `${fileName}.gz`);
const pathHash = crypto.createHash('md5').update(filePath).digest('hex');
const gzippedFile = path.join(utils.getXtransitPath(), `${path.basename(filePath)}-${pathHash}.gz`);
if (await exists(gzippedFile)) {
return gzippedFile;
}
Expand Down

0 comments on commit 08f16a1

Please sign in to comment.