-
-
Notifications
You must be signed in to change notification settings - Fork 32k
fs: adjust typecheck for type
in fs.symlink()
#49741
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -31,7 +31,6 @@ const { | |||||||||||||||||||||||||||||||||||
UVException, | ||||||||||||||||||||||||||||||||||||
codes: { | ||||||||||||||||||||||||||||||||||||
ERR_FS_EISDIR, | ||||||||||||||||||||||||||||||||||||
ERR_FS_INVALID_SYMLINK_TYPE, | ||||||||||||||||||||||||||||||||||||
ERR_INCOMPATIBLE_OPTION_PAIR, | ||||||||||||||||||||||||||||||||||||
ERR_INVALID_ARG_TYPE, | ||||||||||||||||||||||||||||||||||||
ERR_INVALID_ARG_VALUE, | ||||||||||||||||||||||||||||||||||||
|
@@ -647,22 +646,16 @@ function stringToFlags(flags, name = 'flags') { | |||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
const stringToSymlinkType = hideStackFrames((type) => { | ||||||||||||||||||||||||||||||||||||
let flags = 0; | ||||||||||||||||||||||||||||||||||||
if (typeof type === 'string') { | ||||||||||||||||||||||||||||||||||||
switch (type) { | ||||||||||||||||||||||||||||||||||||
case 'dir': | ||||||||||||||||||||||||||||||||||||
flags |= UV_FS_SYMLINK_DIR; | ||||||||||||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||||||||||
case 'junction': | ||||||||||||||||||||||||||||||||||||
flags |= UV_FS_SYMLINK_JUNCTION; | ||||||||||||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||||||||||
case 'file': | ||||||||||||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||||||||||
default: | ||||||||||||||||||||||||||||||||||||
throw new ERR_FS_INVALID_SYMLINK_TYPE(type); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
switch (type) { | ||||||||||||||||||||||||||||||||||||
case undefined: | ||||||||||||||||||||||||||||||||||||
case null: | ||||||||||||||||||||||||||||||||||||
case 'file': | ||||||||||||||||||||||||||||||||||||
return 0; | ||||||||||||||||||||||||||||||||||||
case 'dir': | ||||||||||||||||||||||||||||||||||||
return UV_FS_SYMLINK_DIR; | ||||||||||||||||||||||||||||||||||||
case 'junction': | ||||||||||||||||||||||||||||||||||||
return UV_FS_SYMLINK_JUNCTION; | ||||||||||||||||||||||||||||||||||||
Comment on lines
+649
to
+657
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We intentionally don't fallback to |
||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
return flags; | ||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
// converts Date or number to a fractional UNIX timestamp | ||||||||||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.