(dbx filesClient, dst string, ifExists string)
| 595 | } |
| 596 | |
| 597 | func 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 | |
| 619 | func actionForExistingDestination(dst string, ifExists string, metadata files.IsMetadata) (putDestinationAction, files.IsMetadata, error) { |
| 620 | switch ifExists { |
no test coverage detected