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

Function checkPutDestination

cmd/put.go:597–617  ·  view source on GitHub ↗
(dbx filesClient, dst string, ifExists string)

Source from the content-addressed store, hash-verified

595}
596
597func checkPutDestination(dbx filesClient, dst string, ifExists string) (putDestinationAction, files.IsMetadata, error) {
598 ifExists, err := normalizePutIfExists(ifExists)
599 if err != nil {
600 return putDestinationUpload, nil, err
601 }
602 if ifExists == putIfExistsOverwrite {
603 return putDestinationUpload, nil, nil
604 }
605
606 meta, exists, err := getDestinationMetadata(dbx, dst)
607 if err != nil {
608 return putDestinationUpload, nil, err
609 }
610 if !exists {
611 return putDestinationUpload, nil, nil
612 }
613 if _, ok := meta.(*files.FolderMetadata); ok {
614 return putDestinationUpload, nil, pathConflictErrorWithPath(dst, "destination %q is a folder", dst)
615 }
616 return actionForExistingDestination(dst, ifExists, meta)
617}
618
619func actionForExistingDestination(dst string, ifExists string, metadata files.IsMetadata) (putDestinationAction, files.IsMetadata, error) {
620 switch ifExists {

Callers 1

putFileWithResultFunction · 0.85

Calls 4

normalizePutIfExistsFunction · 0.85
getDestinationMetadataFunction · 0.85

Tested by

no test coverage detected