Skip to content

[Bug]: Inconsistent / Unexpected behaviour when adding attachments to cards via REST API #1352

@tomaslieffering

Description

@tomaslieffering

Where is the problem occurring?

I encountered the problem while interacting with the server (Backend)

What browsers are you seeing the problem on?

No response

Current behavior

Certain orderings of the multipart form parameters in the request body of a POST request to the /api/cards/{cardId}/attachments endpoint results in inconsistent and unexpected behaviour.

When trying to attach a file greater than 64kb, if the name parameter comes after the file parameter eg. in Bruno:

Image

The following validation error is returned:

{
  "code": "E_MISSING_OR_INVALID_PARAMS",
  "problems": [
    "\"name\" is required, but it was not defined."
  ],
  "message": "The server could not fulfill this request (`POST /api/cards/1605938424743724421/attachments`) due to 1 missing or invalid parameter."
}

even though the request is valid.

Swapping the file parameter to be after the name parameter fixes the issue eg. in Bruno:

Image

the request is successful

I initially came across this issue from PHP using Guzzle and have also replicated the error using cURL from the CLI so isn't an issue unique to Bruno

Desired behavior

The request is successful no matter the order of the multipart form request.

If this is not possible, that the significance of the order of the multipart form request is documented somewhere, such as the Swagger docs.

Steps to reproduce

The following cURL request reproduced the error:

curl --request POST \
  --url {plankaBaseUrl}/api/cards/{cardId}/attachments \
  --header 'authorization: Bearer {token}' \
  --header 'content-type: multipart/form-data' \
  --form type=file \
  --form 'file=@{path\to\local\file}\test.csv' \
  --form name=test.csv

where plankaBaseUrl, token, cardId and path\to\local\file are their respective values and test.csv is a file which is > 64kB

Other information

No response

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