From eddc92fbeb182ade147c58fe245d82e689144be9 Mon Sep 17 00:00:00 2001
From: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
Date: Tue, 30 Aug 2022 15:15:03 +0800
Subject: [PATCH] [Fix] Path mapping only once in storage backends (#490)

---
 mmengine/fileio/file_client.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mmengine/fileio/file_client.py b/mmengine/fileio/file_client.py
index 056b814a..a371a186 100644
--- a/mmengine/fileio/file_client.py
+++ b/mmengine/fileio/file_client.py
@@ -87,7 +87,7 @@ class PetrelBackend(BaseStorageBackend):
         filepath = str(filepath)
         if self.path_mapping is not None:
             for k, v in self.path_mapping.items():
-                filepath = filepath.replace(k, v)
+                filepath = filepath.replace(k, v, 1)
         return filepath
 
     def _format_path(self, filepath: str) -> str:
-- 
GitLab