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

Function checkPutStdinDestination

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

Source from the content-addressed store, hash-verified

573}
574
575func checkPutStdinDestination(dbx filesClient, dst string, ifExists string) (putDestinationAction, files.IsMetadata, error) {
576 ifExists, err := normalizePutIfExists(ifExists)
577 if err != nil {
578 return putDestinationUpload, nil, err
579 }
580
581 meta, exists, err := getDestinationMetadata(dbx, dst)
582 if err != nil {
583 if ifExists == putIfExistsOverwrite {
584 return putDestinationUpload, nil, nil
585 }
586 return putDestinationUpload, nil, err
587 }
588 if !exists {
589 return putDestinationUpload, nil, nil
590 }
591 if _, ok := meta.(*files.FolderMetadata); ok {
592 return putDestinationUpload, nil, invalidArgumentsErrorfWithDetails("cannot upload stdin to folder %q; provide a full Dropbox file path", mergeJSONErrorDetails(operationErrorDetails("upload"), pathErrorDetails(dst)), dst)
593 }
594 return actionForExistingDestination(dst, ifExists, meta)
595}
596
597func checkPutDestination(dbx filesClient, dst string, ifExists string) (putDestinationAction, files.IsMetadata, error) {
598 ifExists, err := normalizePutIfExists(ifExists)

Callers 1

putStdinFunction · 0.85

Calls 7

normalizePutIfExistsFunction · 0.85
getDestinationMetadataFunction · 0.85
mergeJSONErrorDetailsFunction · 0.85
operationErrorDetailsFunction · 0.85
pathErrorDetailsFunction · 0.85

Tested by

no test coverage detected