Skip to content

Commit

Permalink
fix: not fail if file "permissions" is str type (Nextcloud 30)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigcat88 committed Apr 27, 2024
1 parent 8a17405 commit 5a12271
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nc_py_api/files/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,13 @@ class FilePermissions(enum.IntFlag):
"""Access to re-share object(s)"""


def permissions_to_str(permissions: int, is_dir: bool = False) -> str:
def permissions_to_str(permissions: int | str, is_dir: bool = False) -> str:
"""Converts integer permissions to string permissions.
:param permissions: concatenation of ``FilePermissions`` integer flags.
:param is_dir: Flag indicating is permissions related to the directory object or not.
"""
permissions = int(permissions) if not isinstance(permissions, int) else permissions
r = ""
if permissions & FilePermissions.PERMISSION_SHARE:
r += "R"
Expand Down

0 comments on commit 5a12271

Please sign in to comment.