Skip to content

Commit

Permalink
Judge is dir via api provided by tos python sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua committed Nov 9, 2024
1 parent aea157e commit fd9c658
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tosfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,9 +859,7 @@ def isdir(self, path: str) -> bool:
if self._is_fns_bucket(bucket):
return True
else:
if "x-tos-directory" not in resp.header._store:
return False
return resp.header._store["x-tos-directory"][1].lower() == "true"
return resp.is_directory
except TosClientError as e:
raise e
except TosServerError as e:
Expand Down Expand Up @@ -914,9 +912,7 @@ def isfile(self, path: str) -> bool:
if self._is_fns_bucket(bucket):
return True
else:
if "x-tos-directory" not in resp.header._store:
return True
return resp.header._store["x-tos-directory"][1].lower() != "true"
return not resp.is_directory
except TosClientError as e:
raise e
except TosServerError as e:
Expand Down

0 comments on commit fd9c658

Please sign in to comment.