Skip to content

fix: preserve WriterTo and ReaderFrom in BasePathFile#577

Open
JY-Sun-K wants to merge 1 commit intospf13:masterfrom
JY-Sun-K:fix/basepath-writerto-readerfrom
Open

fix: preserve WriterTo and ReaderFrom in BasePathFile#577
JY-Sun-K wants to merge 1 commit intospf13:masterfrom
JY-Sun-K:fix/basepath-writerto-readerfrom

Conversation

@JY-Sun-K
Copy link

Closes #576
Issue #576

Summary

  • preserve io.WriterTo and io.ReaderFrom on BasePathFile
  • add regression coverage for io.Copy fast-path behavior through BasePathFs

Why

BasePathFs wraps opened files in BasePathFile, which hides optional interfaces implemented by the underlying file. As a result, io.Copy can no longer observe io.WriterTo / io.ReaderFrom and falls back to the generic copy loop.

This restores those optional interfaces on the wrapper while keeping afero.File unchanged and preserving the existing BasePathFs path-jail behavior.

Test Plan

  • go test ./...

@CLAassistant
Copy link

CLAassistant commented Mar 19, 2026

CLA assistant check
All committers have signed the CLA.

@JY-Sun-K JY-Sun-K force-pushed the fix/basepath-writerto-readerfrom branch from c7213cb to d17dc02 Compare March 19, 2026 05:51
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.

BasePathFile does not forward io.WriterTo/io.ReaderFrom, disabling io.Copy fast paths for wrapped filesystems

2 participants