Skip to content

Conversation

@XingY
Copy link
Contributor

@XingY XingY commented Dec 13, 2025

Rationale

For code scan only, don't merge.

Related Pull Requests

Changes

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modifies the createData method to only relativize ExpData URIs when creating LSIDs if the path is a descendant of the file root. This prevents incorrect relativization of paths that exist outside the root directory hierarchy. The PR is marked as "For code scan only, don't merge."

  • Adds URIUtil import for descendant checking
  • Implements conditional path relativization based on directory hierarchy
  • Normalizes paths before descendant validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


// Only convert to a relative path if this is a descendant of the root:
path = path.normalize();
if (URIUtil.isDescendant(source.getRootPath().toUri(), path.toUri()))
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

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

Potential NullPointerException if source.getRootPath() returns null. Based on usage patterns in other parts of the codebase (e.g., XarReader.java line 924), getRootPath() can return null. Add a null check before calling toUri() on the result.

Suggested change
if (URIUtil.isDescendant(source.getRootPath().toUri(), path.toUri()))
if (source.getRootPath() != null && URIUtil.isDescendant(source.getRootPath().toUri(), path.toUri()))

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants