tzuan16 commented on code in PR #385:
URL: https://github.com/apache/polaris/pull/385#discussion_r1806970513
##########
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:
No, the `StorageLocation` class does the isChildOf comparison by comparing
the _full_ location path, so it doesn't make sense to change something like
`s3://....` to `/s3://....`
--
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]