Skip to content

Conversation

dphulkar-msft
Copy link
Member

Description

  • Feature / Bug Fix: (Brief description of the feature or issue being addressed)

  • Related Links:

  • Issues

  • Team thread

  • Documents

  • [Email Subject]

Type of Change

  • Bug fix
  • New feature
  • Documentation update required
  • Code quality improvement
  • Other (describe):

How Has This Been Tested?

UT added

Thank you for your contribution to AzCopy!

}

// We can ignore the error if we fail to get the share properties.
shareProtocol, _ := getShareProtocolType(ctx, serviceClient, resource, protocol)

if shareProtocol == common.ELocation.File() {
if isSource && fromTo.From() != common.ELocation.File() {
return fmt.Errorf("The %s share has SMB protocol enabled. To copy %s a SMB share, use the appropriate --from-to flag value", direction, direction)
return fmt.Errorf("The %s share has SMB protocol enabled. "+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't you just use the appropriate string in the error message here? Checking is Source above and here seems redundant

}

// We can ignore the error if we fail to get the share properties.
shareProtocol, _ := getShareProtocolType(ctx, serviceClient, resource, protocol)

if shareProtocol == common.ELocation.File() {
if isSource && fromTo.From() != common.ELocation.File() {
return fmt.Errorf("The %s share has SMB protocol enabled. To copy %s a SMB share, use the appropriate --from-to flag value", direction, direction)
return fmt.Errorf("The %s share has SMB protocol enabled. "+
Copy link
Member

@gapra-msft gapra-msft Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("The %s share has SMB protocol enabled. "+
return errors.New("The source share has SMB protocol enabled. "+

}

// We can ignore the error if we fail to get the share properties.
shareProtocol, _ := getShareProtocolType(ctx, serviceClient, resource, protocol)

if shareProtocol == common.ELocation.File() {
if isSource && fromTo.From() != common.ELocation.File() {
return fmt.Errorf("The %s share has SMB protocol enabled. To copy %s a SMB share, use the appropriate --from-to flag value", direction, direction)
return fmt.Errorf("The %s share has SMB protocol enabled. "+
"To copy %s a SMB share, use the appropriate --from-to flag value", location, direction)
Copy link
Member

@gapra-msft gapra-msft Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"To copy %s a SMB share, use the appropriate --from-to flag value", location, direction)
"To copy from a SMB share, use the appropriate --from-to flag value")

}
if !isSource && fromTo.To() != common.ELocation.File() {
return fmt.Errorf("The %s share has SMB protocol enabled. To copy %s a SMB share, use the appropriate --from-to flag value", direction, direction)
return fmt.Errorf("The %s share has NFS protocol enabled. "+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("The %s share has NFS protocol enabled. "+
return errors.New("The destination share has NFS protocol enabled. "+

}
if !isSource && fromTo.To() != common.ELocation.File() {
return fmt.Errorf("The %s share has SMB protocol enabled. To copy %s a SMB share, use the appropriate --from-to flag value", direction, direction)
return fmt.Errorf("The %s share has NFS protocol enabled. "+
"To copy %s a NFS share, use the appropriate --from-to flag value", location, direction)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"To copy %s a NFS share, use the appropriate --from-to flag value", location, direction)
"To copy to a NFS share, use the appropriate --from-to flag value")

Copy link
Member

@gapra-msft gapra-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please address my last comment, then this is good to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants