lima-vm / lima-vm/lima

Invalid image URL can result in 64K of error output

Open
#4,191 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
21.9k
Forks
957
Avg merge
2d 6h
Merged PRs (30d)
53

Description

I can't remember see this before (response truncated), but I have verified that the result is the same with v1.2.1:

```console
❯ curl https://github.com/lima-vm/alpine-lima/releases/download/v0.2.45/alpine-lima-std-3.22.2-aarch64.iso
Not Found

❯ l start -y https://github.com/lima-vm/alpine-lima/releases/download/v0.2.45/alpine-lima-std-3.22.2-aarch64.iso
INFO[0000] Terminal is not available, proceeding without opening an editor
INFO[0000] Starting the instance "alpine-lima-3.22.2" with internal VM driver "vz"
INFO[0000] Attempting to download the image arch=aarch64 digest= location="https://github.com/lima-vm/alpine-lima/releases/download/v0.2.45/alpine-lima-std-3.22.2-aarch64.iso"
FATA[0000] failed to download "https://github.com/lima-vm/alpine-lima/releases/download/v0.2.45/alpine-lima-std-3.22.2-aarch64.iso": unexpected HTTP status Not Found, body="\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n…
```

Maybe there was a change in the GitHub server code when no `Accept` header is specified?

I see our code captures up to 64K of response body:

```go
// HTTPStatusErrorBodyMaxLength specifies the maximum length of HTTPStatusError.Body.
const HTTPStatusErrorBodyMaxLength = 64 * 1024
```

Does this really make sense to spew many pages of HTML code to the terminal as part of a single error message?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.