Skip to content

Conversation

@prdoyle
Copy link
Contributor

@prdoyle prdoyle commented Feb 24, 2025

  • Handles corner cases with . sorting before /
  • Uses correct parent-checking logic for pruning
  • Strips trailing file separators in normalizePath

@prdoyle prdoyle added >non-issue auto-backport Automatically create backport pull requests when merged test-entitlements v8.18.1 v8.19.0 v9.0.1 v9.1.0 :Core/Infra/Entitlements Entitlements infrastructure labels Feb 24, 2025
@prdoyle prdoyle self-assigned this Feb 24, 2025
@prdoyle prdoyle requested a review from a team as a code owner February 24, 2025 16:46
@prdoyle prdoyle changed the title FileAccessTree fixes for ordering and prunint FileAccessTree fixes for ordering and pruning Feb 24, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Feb 24, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

for (int i = 1; i < paths.size(); ++i) {
String nextPath = paths.get(i);
if (nextPath.startsWith(currentPath) == false) {
if (isParent(currentPath, nextPath) == false) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The pruning fix.

return path.toAbsolutePath().normalize().toString();
String result = path.toAbsolutePath().normalize().toString();
while (result.endsWith(FILE_SEPARATOR)) {
result = result.substring(0, result.length() - FILE_SEPARATOR.length());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fix to strip trailing separators

Copy link
Contributor

@jdconrad jdconrad left a comment

Choose a reason for hiding this comment

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

LGTM!

@prdoyle prdoyle merged commit 763e7cd into elastic:main Feb 24, 2025
22 checks passed
@prdoyle prdoyle deleted the remove-trailing-separators branch February 24, 2025 18:50
prdoyle added a commit to prdoyle/elasticsearch that referenced this pull request Feb 24, 2025
* Custom comparator for paths in FileAccessTree

* Strip trailing separators in normalizePath
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.18
8.x
9.0

prdoyle added a commit to prdoyle/elasticsearch that referenced this pull request Feb 24, 2025
* Custom comparator for paths in FileAccessTree

* Strip trailing separators in normalizePath
elasticsearchmachine pushed a commit that referenced this pull request Feb 24, 2025
* Custom comparator for paths in FileAccessTree

* Strip trailing separators in normalizePath
elasticsearchmachine pushed a commit that referenced this pull request Feb 24, 2025
* Custom comparator for paths in FileAccessTree

* Strip trailing separators in normalizePath
elasticsearchmachine pushed a commit that referenced this pull request Feb 24, 2025
* Custom comparator for paths in FileAccessTree

* Strip trailing separators in normalizePath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged :Core/Infra/Entitlements Entitlements infrastructure >non-issue Team:Core/Infra Meta label for core/infra team v8.18.1 v8.19.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants