Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Invalid image URL can result in 64K of error output #4191

@jandubois

Description

@jandubois

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

curl https://github.com/lima-vm/alpine-lima/releases/download/v0.2.45/alpine-lima-std-3.22.2-aarch64.iso
Not Foundl 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<!DOCTYPE html>\n<html\n  lang=\"en\"\n  \n  data-color-mode=\"auto\" data-light-theme=\"light\" data-dark-theme=\"dark\"\n  data-a11y-animated-images=\"system\" data-a11y-link-underlines=\"true\"\n  data-css-features=\"one_click_merge_conflict\"\n  >\n\n\n\n\n  <head>\n    <meta charset=\"utf-8\">\n  <link rel=\"dns-prefetch\" href=\"https://github.githubassets.com\">\n  <link rel=\"dns-prefetch\" href=\"https://avatars.githubusercontent.com\">\n  <link rel=\"dns-prefetch\" href=\"https://github-cloud.s3.amazonaws.com\">\n  <link rel=\"dns-prefetch\" href=\"https://user-images.githubusercontent.com/\">\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:

// 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions