LuciferYang commented on code in PR #8933:
URL: https://github.com/apache/hadoop/pull/8933#discussion_r4572866925
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java:
##########
@@ -121,6 +121,18 @@ private Path makeTrashRelativePath(Path basePath, Path
rmFilePath) {
return Path.mergePaths(basePath, rmFilePath);
}
+ /**
+ * @return true if {@code ancestor} is {@code path} or one of its ancestors,
+ * comparing whole path components: "/user/al" is not an ancestor
+ * of "/user/alice".
+ */
+ private static boolean isAncestorOf(Path ancestor, Path path) {
+ String a = ancestor.toString();
Review Comment:
Fixed. `isAncestorOf` now requires the same scheme and authority and
compares `toUri().getPath()` on whole components, so a fragment no longer
affects either check. Added `testMoveToTrashPathWithFragment`: `.Trash#alias`
returns false and nothing is moved, and `home#alias` is rejected as containing
the trash.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]