Skip to content

Support both PUT and POST presigned URLs #964

@alahiff

Description

@alahiff

Currently POST presigned URLs are used to upload files to S3, as this enables S3 to validate both the checksum and file size. However, this isn't supported by some S3-compatible storage systems (like PowerScale).

The server will be modified to support both. For a PUT presigned URL the value of fields will be null in the json (i.e. None in python). So in the python API:

  • fields is null: use a PUT,
  • fields has content: use a POST

The file simvue/api/objects/artifact/base.py needs to be updated. So this:

        _response = sv_post(
            url=_url,
            headers={},
            params={},
            is_json=False,
            timeout=timeout,
            files={"file": file},
            data=self._init_data.get("fields"),
        )

needs to be replaced with something like:

        if self._init_data.get("fields") is not None:
            _response = sv_post(
                url=_url,
                headers={},
                params={},
                is_json=False,
                timeout=timeout,
                files={"file": file},
                data=self._init_data.get("fields"),
            )
        else:
            with open(file, "rb") as fh:
                _response = requests.put(_url, data=fh)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions