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
7 changes: 4 additions & 3 deletions keepercommander/commands/nested_share_folder/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,13 @@ def walk(fuid):
# Expiration parsing
# ═══════════════════════════════════════════════════════════════════════════

def validate_share_expiration_timestamp(expiration_ms, cmd_name):
def validate_share_expiration_timestamp(expiration_ms, cmd_name, *, now_ms=None):
"""Reject finite expirations that are less than one minute."""
if expiration_ms is None or expiration_ms == -1:
return
min_allowed = int(datetime.datetime.now(timezone.utc).timestamp() * 1000) + MIN_SHARE_EXPIRATION_MS
if expiration_ms < min_allowed:
if now_ms is None:
now_ms = int(datetime.datetime.now(timezone.utc).timestamp() * 1000)
if expiration_ms < now_ms + MIN_SHARE_EXPIRATION_MS:
raise CommandError(
cmd_name,
'Share expiration must be at least 1 minute.',
Expand Down
Loading
Loading