Skip to content

fix(file): create a destination's folders through . and .. as mkdir -p does - #621

Merged
linroid merged 1 commit into
mainfrom
fix/destination-dot-segments
Oct 23, 2026
Merged

linroid merged 1 commit into
mainfrom
fix/destination-dot-segments

Conversation

@linroid

@linroid linroid commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Found while testing destinations with the CLI:

ketch http://…/file.bin ./sub/../up/
Download failed: Disk: Disk I/O error <- IOException: failed to create directory: sub/..

When the destination's folders don't exist yet and the path goes through .., PathFileAccessor fails: okio's createDirectories first lists every missing ancestor (sub, sub/.., sub/../up) and then tries to create sub/.. itself. Any engine-written download (HTTP, FTP, WebDAV, HLS, DASH) with such a folder or file destination failed, from the CLI, the SDK or ketch add.

What changes

PathFileAccessor creates missing folders the way mkdir -p does: each missing component in turn, leaving . and .. to the file system. The path is not rewritten: file destinations stay "used as they are", as execute_fileDestination_usedAsIs requires. Paths without dot segments still go straight to createDirectories.

Verification

  • ketch <url> ./sub/../up/ from this branch saves up/w.bin with the right SHA-256 and creates the empty sub/ on the way, as mkdir -p would. Before: the error above.
  • New PathFileAccessorDirectoriesTest writes through sub/../up/./deeper/file.bin into a folder holding none of them.
  • ./gradlew :library:core:jvmTest --tests '*PathFileAccessor*' --tests '*DownloadExecutionDestPathTest*' passes.

…p does

`ketch <url> ./sub/../up/` failed with "Disk I/O error <- failed to create
directory: sub/.." when neither folder existed: okio's createDirectories
cannot create a path through a .. segment. PathFileAccessor now creates
each missing folder in turn and leaves . and .. to the file system, as
mkdir -p does, keeping the path as it was given.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T15:41:13.515027Z dcd0f47 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Oct 23, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 2 195 files  +1   2 223 suites  +1   56m 57s ⏱️ +13s
15 277 tests +1  15 009 ✅ +1  268 💤 ±0  0 ❌ ±0 
18 630 runs  +1  18 362 ✅ +1  268 💤 ±0  0 ❌ ±0 

Results for commit dcd0f47. ± Comparison against base commit a3b60ac.

@linroid
linroid merged commit c7c6457 into main Oct 23, 2026
15 checks passed
@linroid
linroid deleted the fix/destination-dot-segments branch October 23, 2026 16:00
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.

1 participant