cuducos / chunk

🧱 Chunk is a download manager for slow and unstable servers
MIT License
56 stars 3 forks source link

Cannot continue stopped download on Windows #45

Open cuducos opened 1 year ago

cuducos commented 1 year ago

As described in #44:

Tried to restart download, and the following error was reported:

(base) PS C:\Users\mauricio\chunk_teste> ..\chunk-v1.0.0-windows-amd64.exe https://dadosabertos.rfb.gov.br/CNPJ/Estabelecimentos0.zip
2022/12/26 18:52:46 could not creat a progress file: error loading existing progress file: error decoding progress file C:\Users\mauricio\.chunk\c811d2999ff5d6a15340c98b44fd8126-Estabelecimentos0.zip: unexpected EOF
(base) PS C:\Users\mauricio\chunk_teste>
tonnydourado commented 1 year ago

Just throwing it out there, maybe it helps: the default encoding on Windows is different from normal, decent, god-fearing operational systems (UTF-8).

If I understand this correctly, the C:\Users\mauricio\.chunk\c811d2999ff5d6a15340c98b44fd8126-Estabelecimentos0.zip file is the progress file for Estabelecimentos.zip, right? Maybe it is being saved with a specific UTF-8 encoding but read with the default one? It would work out fine on Linux/Mac, because the default would be UTF-8, but fail on Windows.

It's a wild guess, though.

cuducos commented 1 year ago

That’s a fair guess. I understand that using native’s encoding/gob Go would handle that properly (we are writing and reading bytes, not encoded), so that shouldn’t be an issue. And that’s just a guess as well lol

tonnydourado commented 1 year ago

Ah, the gob thing is from the stdlib? That plus reading bytes makes my hypothesis way more unlikely.