tschaub / mock-fs

Configurable mock for the fs module
https://npmjs.org/package/mock-fs
Other
906 stars 85 forks source link

fix: readdir should check for access rights, fixes #294 #295

Closed warpdesign closed 4 years ago

warpdesign commented 4 years ago

This PR adds access checks to readdirand readdirSync calls.

This should fix #294

tschaub commented 4 years ago

Thanks for the proposed fix, @warpdesign. Now that tests are run in a GitHub workflow (see #296), you'll need to rebase.

3cp commented 4 years ago

Your fixed check reminded us there are three existing this.access(..., parseInt('0002', 8)); should be refactored, or at least replace hard coded parseInt('0002', 8) with constants.W_OK.

warpdesign commented 4 years ago

@tschaub I made the rebase and added err.code check as suggested by @3cp

tschaub commented 4 years ago

Thanks, @warpdesign.