Skip to content

Commit c6654f4

Browse files
Fix: Fixed issue with WindowsIniService not handling duplicate section names (#17429)
Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com> Co-authored-by: Yair <39923744+yaira2@users.noreply.github.com>
1 parent 70970b7 commit c6654f4

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ public List<IniSectionDataItem> GetData(string filePath)
2525
return [];
2626
}
2727

28-
// Get sections
29-
var sections = lines
30-
.Where(line => line.StartsWith('[') && line.EndsWith(']'));
31-
32-
// Get section line indexes
28+
// Get section line indexes directly to handle duplicate section names
3329
List<int> sectionLineIndexes = [];
34-
foreach (var section in sections)
35-
sectionLineIndexes.Add(lines.IndexOf(section));
30+
for (int i = 0; i < lines.Count; i++)
31+
{
32+
if (lines[i].StartsWith('[') && lines[i].EndsWith(']'))
33+
sectionLineIndexes.Add(i);
34+
}
3635

3736
List<IniSectionDataItem> dataItems = [];
3837

@@ -42,10 +41,10 @@ public List<IniSectionDataItem> GetData(string filePath)
4241

4342
var count =
4443
index + 1 == sectionLineIndexes.Count
45-
? (lines.Count - 1) - sectionIndex
46-
: sectionLineIndexes[index + 1] - sectionIndex;
44+
? lines.Count - sectionIndex - 1
45+
: sectionLineIndexes[index + 1] - sectionIndex - 1;
4746

48-
if (count == 0)
47+
if (count <= 0)
4948
continue;
5049

5150
var range = lines.GetRange(sectionIndex + 1, count);

src/Files.App/Views/Shells/ModernShellPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</Grid.RowDefinitions>
5050

5151
<Image
52-
Grid.RowSpan="2"
52+
Grid.RowSpan="3"
5353
HorizontalAlignment="{x:Bind ShellViewModel.FolderBackgroundImageHorizontalAlignment, Mode=OneWay}"
5454
VerticalAlignment="{x:Bind ShellViewModel.FolderBackgroundImageVerticalAlignment, Mode=OneWay}"
5555
Opacity="{x:Bind ShellViewModel.FolderBackgroundImageOpacity, Mode=OneWay}"

0 commit comments

Comments
 (0)