Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Azure path comparison when filePath is root ("/") #385

Merged
merged 3 commits into from
Oct 18, 2024

Conversation

tzuan16
Copy link
Contributor

@tzuan16 tzuan16 commented Oct 18, 2024

Description

The AzureLocation.isChildOf method is currently broken if the parent path points to the root of the container (e.g. abfss://[email protected] or abfss://[email protected]/). The filePath of the path in this case would be parsed as / since we always add a "trailing slash". Now if the comparing child path looks something like abfss://[email protected]/some/file/path/metadata, the filePath would be parsed as some/file/path/metadata/ after applying the trailing slash, leading to the failure of the childFilePath.startsWith(parentFilePath) check since the childFilePath doesn't start with a slash.

Fix is to always ensure a leading slash on top of ensuring a trailing slash.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • AzureLocationTest unit test
  • Test B

Test Configuration:

  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

Please delete options that are not relevant.

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • If adding new functionality, I have discussed my implementation with the community using the linked GitHub issue

@tzuan16 tzuan16 force-pushed the fix-path-comparison branch from 223105b to 67bccbf Compare October 18, 2024 19:49
Copy link
Contributor

@eric-maynard eric-maynard left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix

@eric-maynard eric-maynard enabled auto-merge (squash) October 18, 2024 22:13
@eric-maynard eric-maynard merged commit 3191ea0 into apache:main Oct 18, 2024
5 checks passed
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.

2 participants