nodejs / nodejs/node

`path.win32.isAbsolute` considers relative paths absolute

未关闭
#56,766 11 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

path
主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

描述

Version

22.11.0

Platform
Linux pc 6.8.0-48-generic #48-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 14:04:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem

No response

What steps will reproduce the bug?
require('path').win32.isAbsolute('\\foo') === true
How often does it reproduce? Is there a required condition?

Yes. No.

What is the expected behavior? Why is that the expected behavior?

Here's a behavior of cd on Windows:

C:\Users\user> cd \Windows
C:\Windows>

\Windows is relative to drive name.

Expected output for isAbsolute() is false.

What do you see instead?

isAbsolute() is true.

Additional information

(Edited to prevent the issue from deletion by dumb AI.)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从报告的 require('path').win32.isAbsolute 入口点开始,跟踪其实现和现有的 path 测试。复现 '\foo' 情况,为预期的 Windows 行为添加回归测试覆盖,并验证相关测试通过。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
operating-systems
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
65/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。