From 0a8b8fd19e513947d17028149a2de42ffa7f1138 Mon Sep 17 00:00:00 2001 From: yanghua Date: Tue, 12 Nov 2024 11:59:45 +0800 Subject: [PATCH] Run test cases on hns --- tosfs/core.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tosfs/core.py b/tosfs/core.py index d6adf18..324a8d9 100644 --- a/tosfs/core.py +++ b/tosfs/core.py @@ -846,6 +846,19 @@ def isdir(self, path: str) -> bool: except TosServerError as e: if e.status_code == TOS_SERVER_STATUS_CODE_NOT_FOUND: return False + if (self._get_bucket_type(bucket) == TOS_BUCKET_TYPE_HNS + and e.status_code == CONFLICT_CODE + and e.header._store["x-tos-ec"][1] == "0026-00000020"): + out = retryable_func_executor( + lambda: self.tos_client.list_objects_type2( + bucket, + prefix=key, + delimiter="/", + max_keys=1, + ), + max_retry_num=self.max_retry_num, + ) + return out.key_count > 0 raise e def isfile(self, path: str) -> bool: