util.join() doesn't handle absolute path on Windows correctly
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
- Lĩnh vực
- devtools
Hướng nghiên cứu
Bắt đầu trong lib/util.js tại util.join() và util.isAbsolute(), sử dụng đường dẫn Windows có ký tự ổ đĩa được báo cáo làm reproducer. Kiểm tra cách cả hai điểm vào xử lý các đường dẫn như F:\Projects\... cùng với các đường dẫn có tiền tố là dấu gạch chéo. Hoàn thành khi các đường dẫn Windows tuyệt đối được nhận diện và không bị nối lặp lại trong toàn bộ pipeline của source-map loader; sau đó chạy các test hiện có của project.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
We use the Webpack pipeline on Windows with sass-loader, postcss-loader, and css-loader. Then we found the generated source paths went crazy: F:\Projects\web-project-boilerplate\src\scss\index.scss just becomes F:/Projects/web-project-boilerplate/src/scss/F:/Projects/web-project-boilerplate/src/scss/F:/Projects/web-project-boilerplate/src/scss/index.scss.
As I followed the codebase in the pipeline, I noticed that the sass-loader use relative path, then the postcss-loader and css-loader turn to use absolute path for "sources" field in the sourceMap. In addition, the absolute path on Windows starts with a symbol of the disk driver, e.g. F: in our case. When it comes to sourceMap's util.join(), it only detects absolute path starts with /
https://github.com/mozilla/source-map/blob/c3a8f5a2a4cc7ac5bc6c06bc93745d3c57bd8860/lib/util.js#L228
So it joins multiple paths across the loaders.
Also, the util.isAbsolute doesn't deal with the Windows absolute path as well.
https://github.com/mozilla/source-map/blob/c3a8f5a2a4cc7ac5bc6c06bc93745d3c57bd8860/lib/util.js#L241
Appendix:
Here is a case of how expressjs test the absolute path:
exports.isAbsolute = function(path){
if ('/' === path[0]) return true;
if (':' === path[1] && ('\\' === path[2] || '/' === path[2])) return true; // Windows device path
if ('\\\\' === path.substring(0, 2)) return true; // Microsoft Azure absolute path
};
I'm not sure we need to handle the azure absolute path, but I would be better if we had window device path included.
Thanks
- Ngôn ngữ chính
- JavaScript
- Star
- 3.7k
- Fork
- 370
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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.
Issue khác của mozilla/source-map
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
mozilla/source-map#530 ·
-
allow wasm to be bundled Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
mozilla/source-map#527 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
mozilla/source-map#524 · 6 bình luận ·
-
source map seems like not work, is there some hints from the perspective of source-map tool? Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
mozilla/source-map#516 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
mozilla/source-map#510 · 1 reaction ·
Tất cả issue của mozilla/source-map
Issue tương tự
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Automattic/safe-publish#594 ·
-
内部文件键(绝对路径的 base64)泄漏到界面标签 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
dream-num/dsh-univer-office#104 ·
-
comp/dashboard invalid P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NousResearch/hermes-agent#121143 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
avniproject/avni-webapp#1811 ·
-
area/auroraboot area/webui bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100