Type mismatch in Save-WebFile.ps1

Đang mở
#325 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Lĩnh vực
tooling

Hướng nghiên cứu

The errors come from Save-WebFile.ps1 around lines 145 and 165, where $localExists and the (Get-Item $DestinationFullName).Length comparison are evaluated against a value that PowerShell sees as a String[]. Trace where $localExists and the remote size are assigned, and find why one side becomes an array. Done when re-running Update-OSDCloud -DriverPack Microsoft (or Save-WebFile on a URL whose destination file already exists) finishes without InvalidOperation errors and still skips or replaces the file correctly.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Describe the bug
Downloading driver packs whether for WinPE or offline USB produces the error:

InvalidOperation: C:\Program Files\PowerShell\Modules\OSD\25.10.22.2\Public\Functions\Other\Save-WebFile.ps1:145
Line |
 145 |                  $localExists `
     |                  ~~~~~~~~~~~~~~
     | Could not compare "978731008" to "978731008". Error: "Cannot convert the "System.String[]" value of type
     | "System.String[]" to type "System.Int64"."
InvalidOperation: C:\Program Files\PowerShell\Modules\OSD\25.10.22.2\Public\Functions\Other\Save-WebFile.ps1:165
Line |
 165 |  …         if ($localExists -and ((Get-Item $DestinationFullName).Length …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not compare "978731008" to "978731008". Error: "Cannot convert the "System.String[]" value of type
     | "System.String[]" to type "System.Int64"."

It appears that the driver packs were downloaded successfully despite the error above.

To Reproduce
Update-OSDCloud -DriverPack Microsoft

Expected behavior
No errors are produced

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Windows 11 24H2
  • Browser [e.g. chrome, safari]
Ngôn ngữ chính
PowerShell
Star
251
Fork
102
Merge trung bình
2 phút
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của OSDeploy/OSD

Tất cả issue của OSDeploy/OSD

Issue tương tự

Thêm issue về DevTools

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.