From 029ee89cbfcfe7c9b9b9fea2476af39b764e4448 Mon Sep 17 00:00:00 2001 From: bbhtt Date: Tue, 23 Sep 2025 14:23:44 +0530 Subject: [PATCH] builder-flatpak-utils: Normalize the single trailing slash in pattern `/foobar/` in cleanup pattern should be treated the same as `/foobar`. Fixes https://github.com/flatpak/flatpak-builder/issues/476 --- src/builder-flatpak-utils.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/builder-flatpak-utils.c b/src/builder-flatpak-utils.c index ac55285e..045857c9 100644 --- a/src/builder-flatpak-utils.c +++ b/src/builder-flatpak-utils.c @@ -147,6 +147,16 @@ flatpak_path_match_prefix (const char *pattern, while (*string == '/') string++; + { + size_t len = strlen (pattern); + if (len > 1 && pattern[len - 1] == '/') + { + g_autofree char *normalized = g_strndup (pattern, len - 1); + const char *res = flatpak_path_match_prefix (normalized, string); + return res; + } + } + while (TRUE) { switch (c = *pattern++)