tzuan16 commented on code in PR #385:
URL: https://github.com/apache/polaris/pull/385#discussion_r1806967090
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureLocation.java:
##########
@@ -108,15 +108,24 @@ public boolean isChildOf(@NotNull StorageLocation
potentialParent) {
AzureLocation potentialAzureParent = (AzureLocation) potentialParent;
if (this.container.equals(potentialAzureParent.container)) {
if (this.storageAccount.equals(potentialAzureParent.storageAccount)) {
- String slashTerminatedFilePath = ensureTrailingSlash(this.filePath);
- String slashTerminatedParentFilePath =
ensureTrailingSlash(potentialAzureParent.filePath);
- return
slashTerminatedFilePath.startsWith(slashTerminatedParentFilePath);
+ String formattedFilePath =
ensureLeadingSlash(ensureTrailingSlash(this.filePath));
+ String formattedParentFilePath =
ensureLeadingSlash(ensureTrailingSlash(potentialAzureParent.filePath));
+ return formattedFilePath.startsWith(formattedParentFilePath);
}
}
}
return false;
}
+ /** If a path doesn't start with `/`, this will add one */
+ private @NotNull String ensureLeadingSlash(@NotNull String location) {
Review Comment:
`ensureTrailingSlash` is also called from the parent class
`StorageLocation`, so I wonder if we should just keep them separate
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]