Skip to content

Add share link create command#248

Open
AndreyVMarkelov wants to merge 1 commit into
masterfrom
share-link-create
Open

Add share link create command#248
AndreyVMarkelov wants to merge 1 commit into
masterfrom
share-link-create

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add dbxcli share link create <path> to create or retrieve an existing shared link
  • Idempotent: returns existing URL if link already exists (handles shared_link_already_exists error)
  • Fallback uses ListSharedLinks(path, DirectOnly=true) to avoid returning parent-folder links
  • URL-only stdout output for easy scripting (url=$(dbxcli share link create /file.txt))
  • Uses Dropbox default settings — no visibility/password/expiration flags in this PR
  • Preserves backward compatibility with existing share list link command

Closes #77, closes #113.

Test plan

  • Validates exactly one path argument required
  • Rejects root path
  • Prints URL for newly created file and folder links
  • Uses default settings (nil) for CreateSharedLinkWithSettings
  • Returns existing URL from error metadata without calling ListSharedLinks
  • Fallback prefers exact PathLower match
  • Fallback follows pagination correctly
  • Fallback errors on HasMore with empty cursor (pagination guard)
  • Fallback errors when no direct link found
  • Non-conflict API errors pass through unchanged
  • Existing share list link command still resolves correctly
  • golangci-lint clean, all tests pass

Implement `dbxcli share link create <path>` to create or retrieve an
existing Dropbox shared link for a file or folder. Uses default Dropbox
settings and prints only the URL to stdout for easy scripting.

Handles the shared_link_already_exists error by preferring metadata from
the error response, falling back to ListSharedLinks with DirectOnly=true
to avoid returning parent-folder links.

Closes #77, closes #113.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add share links Request: Add dropbox.py sharelink option

1 participant