From f7eb78f95c511b0758ca076666ce8f6739c400d9 Mon Sep 17 00:00:00 2001 From: Stephanie Kim Date: Mon, 11 Mar 2024 16:57:28 +0000 Subject: [PATCH] GCS: extract tarfile if the content is tarfile Bug: b/324418194 Change-Id: I207f5352a7d00d5bf7a7587dfa60f216adeef7ec Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5346335 Commit-Queue: Stephanie Kim Reviewed-by: Joanna Wang --- gclient.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gclient.py b/gclient.py index 194384b44..4eef76f95 100755 --- a/gclient.py +++ b/gclient.py @@ -2630,8 +2630,9 @@ class GcsDependency(Dependency): calculated=calculated_sha256sum, )) - with tarfile.open(output_file, 'r:*') as tar: - tar.extractall(path=output_dir) + if tarfile.is_tarfile(output_file): + with tarfile.open(output_file, 'r:*') as tar: + tar.extractall(path=output_dir) self.WriteFilenameHash(calculated_sha256sum, hash_file) #override