Skip to content

Commit ed41158

Browse files
authored
Code Quality: Fixed System.ArgumentException in WindowsIniService.GetData (#15878)
1 parent 09b4d19 commit ed41158

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Files.App/Services/Windows/WindowsIniService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ public List<IniSectionDataItem> GetData(string filePath)
5858
.Select(line => line.Split('='))
5959
// Validate
6060
.Where(parts => parts.Length == 2)
61+
// Group by key to avoid duplicates
62+
.GroupBy(parts => parts[0].Trim())
6163
// Gather as dictionary
62-
.ToDictionary(parts => parts[0].Trim(), parts => parts[1].Trim());
64+
.ToDictionary(partsGroup => partsGroup.Key, partsGroup => partsGroup.Last()[1].Trim());
6365

6466
dataItems.Add(new()
6567
{

0 commit comments

Comments
 (0)