From 52ed6cd7eb4c2538c582a67ee3c1a84eb6cfcad3 Mon Sep 17 00:00:00 2001 From: Stephanie Kim Date: Tue, 14 May 2024 17:47:12 +0000 Subject: [PATCH] Replace forward slashes with underscores for GCS output_files We need to preserve the words before the slashes for instances like `Linux_x64/rust-toolchain-31e6e8c6c5b6ce62656c922c7384d3376018c980-2-llvmorg-19-init-9433-g76ea5feb.tar.xz` and `Mac/rust-toolchain-31e6e8c6c5b6ce62656c922c7384d3376018c980-2-llvmorg-19-init-9433-g76ea5feb.tar.xz` Bug: 328065301 Change-Id: I0d745ee8be7751149c292f2bd2f79df2af593bdd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5536288 Commit-Queue: Stephanie Kim Reviewed-by: Josip Sokcevic --- gclient.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gclient.py b/gclient.py index 02d2dd9ae..c9178b254 100755 --- a/gclient.py +++ b/gclient.py @@ -2702,7 +2702,8 @@ class GcsDependency(Dependency): def DownloadGoogleStorage(self): """Calls GCS.""" - gcs_file_name = self.object_name.split('/')[-1] + # Replace forward slashes + gcs_file_name = self.object_name.replace('/', '_') root_dir = self.root.root_dir # Directory of the extracted tarfile contents @@ -2710,8 +2711,8 @@ class GcsDependency(Dependency): output_file = os.path.join(output_dir, self.output_file or f'.{gcs_file_name}') - # Remove any forward slashes and drop any extensions - file_prefix = self.object_name.replace('/', '_').replace('.', '_') + # Drop any extensions + file_prefix = gcs_file_name.replace('.', '_') hash_file = os.path.join(output_dir, f'.{file_prefix}_hash') migration_toggle_file = os.path.join( output_dir,