Skip to content

Commit

Permalink
Reapply #1384 (#1427)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakulkar-msft authored May 7, 2021
1 parent 3e260ac commit 6c877ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/credentialUtil.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func getCredentialType(ctx context.Context, raw rawFromToInfo, cpkOptions common
// For to Trash direction, use source as resource URL
// Also, by setting isSource=false we inform getCredentialTypeForLocation() that resource
// being deleted cannot be public.
credType, _, err = getCredentialTypeForLocation(ctx, raw.fromTo.From(), raw.source, raw.sourceSAS, true, cpkOptions)
credType, _, err = getCredentialTypeForLocation(ctx, raw.fromTo.From(), raw.source, raw.sourceSAS, false, cpkOptions)
case raw.fromTo.From().IsRemote() && raw.fromTo.To().IsLocal():
// we authenticate to the source.
credType, _, err = getCredentialTypeForLocation(ctx, raw.fromTo.From(), raw.source, raw.sourceSAS, true, cpkOptions)
Expand Down
4 changes: 2 additions & 2 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ func (cooked cookedListCmdArgs) HandleListContainerCommand() (err error) {
return err
}

// Treat our check as a destination because the isSource flag was designed for S2S transfers.
if credentialInfo, _, err = getCredentialInfoForLocation(ctx, cooked.location, source.Value, source.SAS, false, common.CpkOptions{}); err != nil {
// isSource is rather misnomer for canBePublic. We can list public containers, and hence isSource=true
if credentialInfo, _, err = getCredentialInfoForLocation(ctx, cooked.location, source.Value, source.SAS, true, common.CpkOptions{}); err != nil {
return fmt.Errorf("failed to obtain credential info: %s", err.Error())
} else if cooked.location == cooked.location.File() && source.SAS == "" {
return errors.New("azure files requires a SAS token for authentication")
Expand Down

0 comments on commit 6c877ce

Please sign in to comment.