Repository navigation
Fix 385 no entity paths for eln crates #396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Pfeil
wants to merge
9
commits into
development
Choose a base branch
from
fix-385-no-entity-paths-for-eln-crates
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
416a97c
test: ensure ELN style crates read file paths properly
Pfeil b94b763
refactor: extract metadata JSON lookup into reader strategy and use it
Pfeil 4c5e08d
fix: set file locations for Dataset entities when reading crates
Pfeil f78fa62
fix: handle Windows paths when reading folders
Pfeil 637e177
test: cover untracked files with relative crate path reads
Pfeil b1f242c
test: enhance test to check if relative paths work in conjunction with
Pfeil 95cb2b8
fix: reading crates from relative paths now output untracked files
Pfeil 23ec84a
fix: replace undocumented runtime exception with documented IOException
Pfeil 1ce50cf
fix: make untracked file detection independent of crate location form
Pfeil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep non-filesystem Dataset IDs readable on Windows.
For a Dataset ID such as
urn:uuid:12345678-1234-1234-1234-123456789abc,IdentifierUtils.isUrlreturns false under the standard URL handlers. This new call then reachesbasePath.resolve(filename). Java 17 on Windows rejects the colons withInvalidPathException, which aborts the import. Previously, this Dataset remained pathless. Treat invalid filesystem candidates as nonlocal, while preserving lookup for ordinary relative paths. (raw.githubusercontent.com)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
Script executed:
Length of output: 21618
Script executed:
Length of output: 31029
Script executed:
Length of output: 27196
@PfeilProblem: On Windows, a Dataset ID can be a valid identifier but an invalid file path. For example,urn:uuid:12345678-1234-1234-1234-123456789abcis not recognized as a URL by the standard Java URL handlers. Windows rejects its colons when the reader tries to use it as a path. The resultingInvalidPathExceptionstops the import.Line hints:
CrateReader.javaLine 140 passes the Dataset ID tocheckFolderHasFile.CrateReader.javaLine 249 checks for a URL, and Line 256 resolves the ID as a path.IdentifierUtils.javaLine 51 and Line 67 show how the URL check works.A fix should skip an invalid path candidate without stopping the import. It should still try other candidates and resolve valid local paths.
Proposed JUnit test: Run this test on Windows. It checks that the URN Dataset remains pathless and that a local Dataset still gets its path.
I have not run the test. On the current code, the import is expected to fail on Windows before the path assertions.
You are interacting with an AI system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that, according to the specification, such identifiers would be prefixes with a "#", which we could make use of?
Please read the specification (https://www.researchobject.org/ro-crate/specification/1.3/data-entities.html#directory-data-entity) and reconsider all aspects of the problem. Please write an updated, concise report.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
web_search executed:
Read the official RO-Crate 1.3 specification at https://www.researchobject.org/ro-crate/specification/1.3/data-entities.html#directory-data-entity and related identifier sections. What identifiers are permitted for directory data entities, contextual or virtual datasets, and external datasets? Are fragment identifiers (#...) required, and are absolute URNs permitted? Note percent-encoded path rules.Length of output: 16332
Script executed:
Length of output: 10107
Script executed:
Length of output: 39236
Script executed:
Length of output: 22654
@PfeilYou are right that#identifies a local Dataset that is not a Data Entity, even ifhasPartlinks to it. The specification also permits absolute URIs for Dataset Data Entities. Therefore,#is not required for every nonlocal Dataset.Updated findings:
urn:uuid:12345678-1234-1234-1234-123456789abccan still stop import withInvalidPathException. It is an absolute URI, butIdentifierUtils.isUrldoes not recognize it with the standard Java URL handlers.#groupis not a filesystem path. If a directory named#groupexists, the current lookup can assign it as the Dataset’s location.CrateReader.javaLine 140 passes the Dataset ID to the lookup. Lines 249–256 check for a URL and resolve the remaining IDs as paths.IdentifierUtils.javaLines 67–73 require a Java URL handler.Skip fragment IDs and absolute URIs before filesystem lookup. Handle invalid path candidates without aborting the import. Continue to resolve relative paths, including encoded names such as
%23group/.Proposed JUnit tests: These test the lookup directly. The previous integration test can also check that the full import succeeds.
I have not run these tests. The finding remains valid, so I am not marking it as addressed.
You are interacting with an AI system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the first test: If a folder exists with this fragment, we really should ignore that? I am not sure about this. We should understand the initial intention and act gracefully.
About the second test:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
web_search executed:
In the official RO-Crate 1.3 specification, what distinguishes an @id such as "#group" from a directory path such as "%23group/"? Are absolute URNs valid data entity identifiers? Find precise statements in the data entity and identifier sections, and cite the official pages.Length of output: 4245
Script executed:
Length of output: 13432
Script executed:
Length of output: 14105
@PfeilYour suggestion is reasonable as a compatibility choice. My earlier recommendation to always skip fragment IDs was too strong.The specification treats
#groupas a local identifier, not a directory path. A directory named#groupwould normally use an encoded path such as%23group/. However, the reader can still check for a same-named directory to support existing crates. That match is a compatibility behavior, not a requirement of the specification.The same approach can apply to a URN that Java does not recognize as a URL:
InvalidPathExceptionfor that candidate and try the next one.This preserves the existing URL check. It also avoids making an import fail merely because a nonlocal identifier cannot be used as a path. The existing containment check is lexical; it does not prevent a symbolic link from pointing outside the crate.
Tests: The colon example specifically reproduces the exception on Windows. You are right that the general behavior should be tested on all platforms. For example, a test can create a directory named
data%00and look updata%00/. The decoded candidate contains a NUL character and is invalid, but the original candidate can still match. A second case can check that an invalid candidate with no match returns empty. The earlier fragment test should instead reflect the chosen compatibility behavior.I have not run these tests. When you say “both actions should fail,” do you mean that an unsuccessful path lookup should also stop the entire crate import?
I am not marking the original Windows exception finding as addressed.
You are interacting with an AI system.