Type mismatch in Save-WebFile.ps1

Aperta
#325 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Ambito
tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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]
Lingua principale
PowerShell
Stelle
251
Fork
102
Merge medio
2m
PR unite (30g)
4

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OSDeploy/OSD

Tutte le issue di OSDeploy/OSD

Issue simili

Altre issue su DevTools

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.