Skip to content

Commit 3746666

Browse files
Fix
1 parent 61e839b commit 3746666

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

ProtectionScan/Features/MainFeature.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,28 @@ private static void InsertNode(Dictionary<string, object> nestedDictionary,
376376
}
377377

378378
// If the "leaf" dictionary has been reached, add the file and its protections.
379-
current.Add(pathParts[^1], protections);
379+
if (current.ContainsKey(pathParts[^1]))
380+
{
381+
var array1 = (string[])current[pathParts[^1]];
382+
var array2 = protections;
383+
384+
string[] result = new string[array1.Length + array2.Length];
385+
for (int i = 0; i < array1.Length; i++)
386+
{
387+
result[i] = array1[i];
388+
}
389+
390+
for (int i = 0; i < array2.Length; i++)
391+
{
392+
result[array1.Length + i] = array2[i];
393+
}
394+
395+
current[pathParts[^1]] = result;
396+
}
397+
else
398+
{
399+
current.Add(pathParts[^1], protections);
400+
}
380401
}
381402
#endif
382403
}

0 commit comments

Comments
 (0)