Browse Source

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 <kimstephanie@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Stephanie Kim 1 year ago
parent
commit
52ed6cd7eb
1 changed files with 4 additions and 3 deletions
  1. 4 3
      gclient.py

+ 4 - 3
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,