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 5, 2024
1 parent 51be251 commit ae80e04
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 @@ -854,9 +854,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 @@ -909,9 +907,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 ae80e04

Please sign in to comment.