ToNamespacedPath doesn't work with device names
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 122k
- Fork
- 37.3k
- Merge trung bình
- 4 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 283
Mô tả
Version
v20.16.0
Platform
Microsoft Windows NT 10.0.22635.0 x64
Subsystem
No response
What steps will reproduce the bug?
import path from 'node:path'
console.log(path.toNamespacedPath("COM3"))
How often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior? Why is that the expected behavior?
This should print:
\\.\COM3
which is the fully qualified path in the device namespace
What do you see instead?
This prints the illegal path:
\\?\C:\Users\dan\COM3
Additional information
Reference for legal path name: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#win32-device-namespaces
Additionally console.log(url.pathToFileURL("COM3").href) prints an invalid URL, but I'm not sure if there is a corresponding valid file: URL.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với việc tái hiện node:path toNamespacedPath("COM3") trên Windows và so sánh với đường dẫn namespace thiết bị dự kiến \.\COM3. Kiểm tra hành vi liên quan của url.pathToFileURL("COM3") để có thêm ngữ cảnh; được xem là hoàn tất khi API path trả về đường dẫn thiết bị hợp lệ mà không làm hỏng các đường dẫn thông thường.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend, operating-systems
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 68/100