Unverified Commit 730a53a0 authored by Miao Zheng's avatar Miao Zheng Committed by GitHub
Browse files

[Fix] Path mapping only once in storage backends (#2204)



* [Fix] Path mapping only once in storage backends

* Fix lint
Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>
parent 832b8452
...@@ -74,7 +74,7 @@ class CephBackend(BaseStorageBackend): ...@@ -74,7 +74,7 @@ class CephBackend(BaseStorageBackend):
filepath = str(filepath) filepath = str(filepath)
if self.path_mapping is not None: if self.path_mapping is not None:
for k, v in self.path_mapping.items(): for k, v in self.path_mapping.items():
filepath = filepath.replace(k, v) filepath = filepath.replace(k, v, 1)
value = self._client.Get(filepath) value = self._client.Get(filepath)
value_buf = memoryview(value) value_buf = memoryview(value)
return value_buf return value_buf
...@@ -129,7 +129,7 @@ class PetrelBackend(BaseStorageBackend): ...@@ -129,7 +129,7 @@ class PetrelBackend(BaseStorageBackend):
filepath = str(filepath) filepath = str(filepath)
if self.path_mapping is not None: if self.path_mapping is not None:
for k, v in self.path_mapping.items(): for k, v in self.path_mapping.items():
filepath = filepath.replace(k, v) filepath = filepath.replace(k, v, 1)
return filepath return filepath
def _format_path(self, filepath: str) -> str: def _format_path(self, filepath: str) -> str:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment