MCPcopy Create free account
hub / github.com/dropbox/dbxcli / downloadSharedLinkRelativeFile

Function downloadSharedLinkRelativeFile

cmd/share_link_download.go:318–335  ·  view source on GitHub ↗
(dbx sharedLinkClient, baseArg *sharing.GetSharedLinkMetadataArg, relPath, dst string, errOut io.Writer)

Source from the content-addressed store, hash-verified

316}
317
318func downloadSharedLinkRelativeFile(dbx sharedLinkClient, baseArg *sharing.GetSharedLinkMetadataArg, relPath, dst string, errOut io.Writer) error {
319 arg := sharing.NewGetSharedLinkMetadataArg(baseArg.Url)
320 arg.Path = sharedLinkAPIPath(relPath)
321 arg.LinkPassword = baseArg.LinkPassword
322
323 return retryWithBackoff(func() error {
324 link, contents, err := dbx.GetSharedLinkFileContext(currentContext(), arg)
325 if err != nil {
326 return err
327 }
328 if contents == nil {
329 return errors.New("shared link download response did not include file content")
330 }
331 defer func() { _ = contents.Close() }()
332
333 return copySharedLinkContentToFile(contents, sharedLinkDownloadSize(link), dst, errOut)
334 })
335}
336
337func sharedLinkEntryRelativePath(pathDisplay string, rootName string) (string, error) {
338 rel := strings.TrimPrefix(pathDisplay, "/")

Callers 1

downloadSharedLinkFolderFunction · 0.85

Calls 7

sharedLinkAPIPathFunction · 0.85
retryWithBackoffFunction · 0.85
currentContextFunction · 0.85
sharedLinkDownloadSizeFunction · 0.85
CloseMethod · 0.80

Tested by

no test coverage detected