The AzureLocation.isChildOf method is currently broken if the parent path points to the root of the container (e.g. abfss://container@acc.blob.core.windows.net or abfss://container@acc.blob.core.windows.net/). 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://container@acc.blob.core.windows.net/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.
[x] 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
[x] AzureLocationTest unit test
[ ] Test B
Test Configuration:
Hardware:
Toolchain:
SDK:
Checklist:
Please delete options that are not relevant.
[x] I have performed a self-review of my code
[x] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[ ] If adding new functionality, I have discussed my implementation with the community using the linked GitHub issue
Description
The
AzureLocation.isChildOf
method is currently broken if the parent path points to the root of the container (e.g.abfss://container@acc.blob.core.windows.net
orabfss://container@acc.blob.core.windows.net/
). ThefilePath
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 likeabfss://container@acc.blob.core.windows.net/some/file/path/metadata
, thefilePath
would be parsed assome/file/path/metadata/
after applying the trailing slash, leading to the failure of thechildFilePath.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.
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
Test Configuration:
Checklist:
Please delete options that are not relevant.