Skip to content

Commit 5a12271

Browse files
committed
fix: not fail if file "permissions" is str type (Nextcloud 30)
1 parent 8a17405 commit 5a12271

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nc_py_api/files/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,13 @@ class FilePermissions(enum.IntFlag):
282282
"""Access to re-share object(s)"""
283283

284284

285-
def permissions_to_str(permissions: int, is_dir: bool = False) -> str:
285+
def permissions_to_str(permissions: int | str, is_dir: bool = False) -> str:
286286
"""Converts integer permissions to string permissions.
287287
288288
:param permissions: concatenation of ``FilePermissions`` integer flags.
289289
:param is_dir: Flag indicating is permissions related to the directory object or not.
290290
"""
291+
permissions = int(permissions) if not isinstance(permissions, int) else permissions
291292
r = ""
292293
if permissions & FilePermissions.PERMISSION_SHARE:
293294
r += "R"

0 commit comments

Comments
 (0)