From c2a7e990bd38e7646cfe1de3104c0b362817b841 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 7 Jul 2025 11:01:39 +0200 Subject: [PATCH] tools.func: better handling when unpacking tarfiles in prebuild mode (#5781) --- misc/tools.func | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/misc/tools.func b/misc/tools.func index 0e0a5ea0d..e59602162 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -957,7 +957,11 @@ function fetch_and_deploy_gh_release() { fi $STD unzip "$tmpdir/$filename" -d "$target" elif [[ "$filename" == *.tar.* ]]; then - tar --strip-components=1 -xf "$tmpdir/$filename" -C "$target" + if tar -tf "$tmpdir/$filename" | grep -qE '^([^/]+/){2}'; then + tar --strip-components=1 -xf "$tmpdir/$filename" -C "$target" + else + tar -xf "$tmpdir/$filename" -C "$target" + fi else msg_error "Unsupported archive format: $filename" rm -rf "$tmpdir"