Commit 78516a75 authored by martin hou's avatar martin hou

fix: 仅为重复了的条目使用新的md5签名

parent 43b53583
...@@ -800,15 +800,19 @@ Jensen.prototype.listFiles = async function () { ...@@ -800,15 +800,19 @@ Jensen.prototype.listFiles = async function () {
} }
// 如果files有重复的signature,那就持续改为不重复的为止 // 如果files有重复的signature,那就持续改为不重复的为止
let seen = new Set(); // Check for duplicate signatures and regenerate if needed
for (let i = 0; i < files.length; i++) { const signatureCounts = {};
let file = files[i]; files.forEach(file => {
while (seen.has(file.signature)) { signatureCounts[file.signature] = (signatureCounts[file.signature] || 0) + 1;
// Append a random number to make signature unique });
file.signature = md5(file.signature + Math.random());
// Only regenerate signatures for items that have duplicates
files.forEach(file => {
if (signatureCounts[file.signature] > 1) {
// Add timestamp to make signature unique
file.signature = md5(`${file.name}${file.length}`);
} }
seen.add(file.signature); });
}
// 如果已经等待过长的时间了,那就直接返回好了 // 如果已经等待过长的时间了,那就直接返回好了
let kv = tag + '-timer'; let kv = tag + '-timer';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment