Skip to content

Commit 01d84be

Browse files
author
Danil
committed
change hardcoded share_type ids to constants
1 parent c372071 commit 01d84be

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

NextCloud.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,17 @@ def create_share(
221221
url = self.get_local_url()
222222
if public_upload:
223223
public_upload = "true"
224-
if (path is None or not isinstance(share_type, int)) or (share_type in [0, 1] and share_with is None):
224+
if (path is None or not isinstance(share_type, int)) \
225+
or (share_type in [ShareType.GROUP, ShareType.USER, ShareType.FEDERATED_CLOUD_SHARE]
226+
and share_with is None):
225227
return False
226228

227229
data = {"path": path, "shareType": share_type}
228230
if share_type in [ShareType.GROUP, ShareType.USER, ShareType.FEDERATED_CLOUD_SHARE]:
229231
data["shareWith"] = share_with
230232
if public_upload:
231233
data["publicUpload"] = public_upload
232-
if share_type == 3 and password is not None:
234+
if share_type == ShareType.PUBLIC_LINK and password is not None:
233235
data["password"] = str(password)
234236
if permissions is not None:
235237
data["permissions"] = permissions

0 commit comments

Comments
 (0)