Skip to content
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

fix: createWriteStream failing to create new files in directories #783

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

dy-dx
Copy link
Contributor

@dy-dx dy-dx commented Feb 22, 2024

This issue provides most of the context: #428

#428 suggests just to replace fs.statSync(path) with fs.statSync(dirname(path)), but that could cause surprising behavior in the case where multiple filesystems include the parent directory.

I've added a regression test for this case: "createWriteStream writes to an existing file even if parent dir exists on an earlier fss"

Fixes #428

@dy-dx
Copy link
Contributor Author

dy-dx commented Mar 7, 2024

I've just noticed that unionfs iterates backwards through the this.fss array for most operations, except when using createWriteStream/createReadStream.

This seems like a mistake, and I'll address it in this PR as well.

Addressed in #785

@G-Rath G-Rath changed the title fix createWriteStream failing to create new files, fixes #428 fix: createWriteStream failing to create new files in directories Mar 15, 2024
@G-Rath G-Rath merged commit cc52c7f into streamich:master Mar 15, 2024
11 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 19, 2024
## [4.5.2](v4.5.1...v4.5.2) (2024-03-19)

### Bug Fixes

* `createWriteStream` failing to create new files in directories ([#783](#783)) ([cc52c7f](cc52c7f))
Copy link

🎉 This PR is included in version 4.5.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ufs.createWriteStream fails when folder exists but file does not
2 participants