oxidecomputer / oxidecomputer/console

Compressed images fail after upload

Open
#1,920 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
228
Forks
22
Avg merge
19h 42m
Merged PRs (30d)
32

Description

As expected if you attempt to upload a compressed raw image, the upload will fail (we do not support it currently). In terms of network requests we see a number of normal bulk-write requests until we reach the end of the file at which point we receive a 400 response from nexus. The error looks like:

{
    "request_id": "79a6c964-b41e-4691-933d-39a2b6626755",
    "error_code": "InvalidRequest",
    "message": "Data length not block size multiple"
}

image

While we can't completely verify that the submitted file is correct, we can probably add some checks at file selection time to try and detect the error prior to uploading the entire image. Looking at the form data for the compressed vs uncompressed files in this case:

Compressed

{
  "name": "Fedora-Cloud-Base-39-1.5.x86_64.raw.xz",
  "size": 446022784,
  "type": "application/x-xz"
}

Uncompressed

{
  "name": "Fedora-Cloud-Base-39-1.5.x86_64.raw",
  "size": 5368709120,
  "type": "image/x-panasonic-rw"
}

We can probably use the type and size fields to make a guess about if the file will work or not. Given that this is not a rigorous check (the browser thinks the .raw file is a photograph) maybe we display some kind of warning if we detect specific formats that we know do not work.

And if my basic understanding of block size is correct we can also check the size reported by the browser against the selected block size. (Though I don't know how accurate these reported values are).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the image upload form and its file-selection handling, then inspect how selected file type and size are passed into the bulk-write requests. Reproduce the issue with the compressed .raw.xz and uncompressed .raw examples; done means unsupported formats or block-size mismatches are detected before upload and communicated clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.