Skip to content

Compressed images fail after upload #1920

Open

Description

@augustuswm

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).

Activity

  1. david-crespo commented on Oct 14, 2024

    @david-crespo
    Collaborator

    We added the soft validation in #2217

    However, the failure at the end of upload here seems like API bug that shouldn't be related to the image being compressed. Images that don't work should not fail until you actually try to boot them — the upload process is totally agnostic to the bytes being written to the disk.

  2. david-crespo commented on Apr 9, 2025

    @david-crespo
    Collaborator

    Just ran into this while trying to upload a bad image on purpose to create a failed instance. If we don't change the API logic, we could at least check that the content length in bytes is a multiple of block size before we let the user sit there for a while watching the file upload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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