Skip to content

fix: encoded paths are not read back - #353

Merged
Pfeil merged 11 commits into
developmentfrom
320-encoded-paths-are-not-read-back-in
Jul 27, 2026
Merged

fix: encoded paths are not read back#353
Pfeil merged 11 commits into
developmentfrom
320-encoded-paths-are-not-read-back-in

Conversation

@Pfeil

@Pfeil Pfeil commented Jul 22, 2026

Copy link
Copy Markdown
Member

Fixes #320

The issue is actually that IDs get encoded, and their files get the encoded filenames. When reading the IDs back and decoding them, the path is not correct any more.

The fix will be:

  • Filenames should use the decoded id as file name, not the encoded one
    • The fix was within a writer strategy. Ensure the other writers also do it correctly.

In order to not break existing crates:

  • Reading a crate, it will detect both, files with the decoded or, as a fallback, the encoded names. This fix was in the CrateReader and applies to all strategies (folder, zip, ...).
  • Saving the crate, it ensures the files are named correctly. This means affected crates can be simply read and saved again.

Other:

  • Figure out what the issue of windows is, again.

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of file entities whose IDs contain emojis, spaces, or other special characters.
    • Ensured encoded and decoded filenames are resolved correctly when reading crates.
    • Preserved accurate file paths for data entities after writing and reading crates.
  • Tests

    • Expanded coverage for special-character IDs and encoded filenames.
    • Added validation for resolved entity paths and filename handling.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

ReadAndWriteTest is reformatted and expanded with tests covering special-character entity identifiers, encoded filenames, decoded filenames, and resolved file paths after crate write/read operations.

Changes

Encoded path test coverage

Layer / File(s) Summary
Path resolution coverage
src/test/java/.../ReadAndWriteTest.java
Existing read/write assertions are reformatted, while new tests verify non-null paths for special-character identifiers and correct entity and filename resolution for encoded and decoded filenames.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing how encoded paths are read back from crates.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 320-encoded-paths-are-not-read-back-in

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/test/java/edu/kit/datamanager/ro_crate/crate/ReadAndWriteTest.java`:
- Around line 79-140: Update the folder writer to create decoded filenames, and
update the reader’s checkFolderHasFile flow to probe the decoded name first,
then the raw encoded name while preserving the directory-containment guard.
Extend testEncodedIdsFindTheirPaths to include a legacy encoded filename, then
re-save and re-read it to verify migration compatibility.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 04156f2f-d11c-411c-b9f6-69c95acef06f

📥 Commits

Reviewing files that changed from the base of the PR and between 2f83a33 and 20052d3.

📒 Files selected for processing (1)
  • src/test/java/edu/kit/datamanager/ro_crate/crate/ReadAndWriteTest.java

@Pfeil
Pfeil marked this pull request as draft July 22, 2026 16:08
@Pfeil
Pfeil changed the base branch from main to development July 23, 2026 07:42
@Pfeil
Pfeil marked this pull request as ready for review July 27, 2026 09:15
@Pfeil Pfeil linked an issue Jul 27, 2026 that may be closed by this pull request
@Pfeil
Pfeil merged commit 90f814f into development Jul 27, 2026
15 checks passed
@Pfeil
Pfeil deleted the 320-encoded-paths-are-not-read-back-in branch July 27, 2026 09:17
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.

Encoded Paths are Not Read Back In

1 participant