mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
fs,test: add URL to string to fs.watch
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: https://github.com/nodejs/node/pull/51346 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
1 parent
e942dc1d0c
commit
e8fffebdd3
2 files changed
+9
-3
No files matched your search
@@ -108,7 +108,6 @@ const {
|
||||
getValidatedPath,
|
||||
getValidMode,
|
||||
handleErrorFromBinding,
|
||||
possiblyTransformPath,
|
||||
preprocessSymlinkDestination,
|
||||
Stats,
|
||||
getStatFsFromBinding,
|
||||
@@ -2451,7 +2450,7 @@ function watch(filename, options, listener) {
|
||||
|
||||
let watcher;
|
||||
const watchers = require('internal/fs/watchers');
|
||||
const path = possiblyTransformPath(filename);
|
||||
const path = getValidatedPath(filename);
|
||||
// TODO(anonrig): Remove non-native watcher when/if libuv supports recursive.
|
||||
// As of November 2022, libuv does not support recursive file watch on all platforms,
|
||||
// e.g. Linux due to the limitations of inotify.
|
||||
|
||||
Vendored
+8
-1
@@ -265,6 +265,13 @@ const regularFile = __filename;
|
||||
permission: 'FileSystemRead',
|
||||
resource: path.toNamespacedPath(blockedFile),
|
||||
}));
|
||||
assert.throws(() => {
|
||||
fs.watch(blockedFileURL, () => {});
|
||||
}, common.expectsError({
|
||||
code: 'ERR_ACCESS_DENIED',
|
||||
permission: 'FileSystemRead',
|
||||
resource: path.toNamespacedPath(blockedFile),
|
||||
}));
|
||||
|
||||
// doesNotThrow
|
||||
fs.readdir(allowedFolder, (err) => {
|
||||
@@ -353,4 +360,4 @@ const regularFile = __filename;
|
||||
permission: 'FileSystemRead',
|
||||
resource: path.toNamespacedPath(blockedFile),
|
||||
}));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user