Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions nc_py_api/files/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@ def path(self) -> str:
"""Share path relative to the user's root directory."""
return self._raw_data.get("path", "").lstrip("/")

@property
def token(self) -> str:
"""Token for the Shared object."""
# Nextcloud pre-initializes token to null and overwrites it for types that have it.
return self._raw_data.get("token") or ""

@property
def label(self) -> str:
"""Label for the Shared object."""
Expand Down
2 changes: 2 additions & 0 deletions tests/actual_tests/files_sharing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def _test_share_fields(new_share: Share, get_by_id: Share, shared_file: FsNode):
assert new_share.permissions & FilePermissions.PERMISSION_READ
assert new_share.url
assert new_share.path == shared_file.user_path
assert new_share.token
assert get_by_id.token == new_share.token
assert get_by_id.share_id == new_share.share_id
assert get_by_id.path == new_share.path
assert get_by_id.mimetype == new_share.mimetype
Expand Down