From 1bc8d4d3d1e22dadd2bcdb27809dc66c6858acd3 Mon Sep 17 00:00:00 2001 From: Kirottu Date: Sun, 9 Apr 2023 20:50:18 +0300 Subject: [PATCH] Fixed last desktop action from desktop file losing the last key value pair --- plugins/applications/src/scrubber.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/applications/src/scrubber.rs b/plugins/applications/src/scrubber.rs index 7ecfc97..8875f8f 100644 --- a/plugins/applications/src/scrubber.rs +++ b/plugins/applications/src/scrubber.rs @@ -30,11 +30,15 @@ impl DesktopEntry { let mut line = None; let mut new_sections = Vec::new(); - for section in sections.iter() { + for (i, section) in sections.iter().enumerate() { if let Some(line) = line { let mut section = section.to_vec(); section.insert(0, line); - section.pop(); + + // Only pop the last redundant entry if it isn't the last item + if i < sections.len() - 1 { + section.pop(); + } new_sections.push(section); } line = Some(section.last().unwrap_or(&""));