Multiple new lines not accepted in description
Summary
When using the new releases API, a new-line character (0xa) causes the API to respond with a HTTP/1.1 400 Bad Request error.
Steps to reproduce
I bumped into this while trying to publish a release from .gitlab-ci.yml
script:
- CI_COMMIT_TAG_MESSAGE="$(printf "A\n\nB\n)"
- echo "${CI_COMMIT_TAG_MESSAGE}" | hexdump -C
- |
curl \
--data "{\"tag_name\": \"${CI_COMMIT_TAG}\", \"name\": \"${CI_PROJECT_NAME} ${CI_COMMIT_TAG}\", \"description\": \"${CI_COMMIT_TAG_MESSAGE:-No release notes.}\"}" \
--fail \
--header "Content-Type: application/json" \
--header "Private-Token: ${CI_PRIVATE_TOKEN}" \
--output "/dev/null" \
--request POST \
--show-error \
--silent \
--trace-ascii "/dev/stderr" \
--write-out "HTTP response: %{http_code}\n\n" \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases"
is the exact step I performed. It is quite easy to do this locally with cURL of course (I did, but without the hexdump echoing to validate the output)
While markdown seems to work, new-lines do not.
What is the current bug behavior?
$ echo "${CI_COMMIT_TAG_MESSAGE}" | hexdump -C
00000000 41 0a 0a 42 0a |A..B.|
00000005
$ curl \ # collapsed multi-line command
<snip>
=> Send data, 87 bytes (0x57)
0000: {"tag_name": "v1", "name": "v1",
0040: "description": "A..B"}
== Info: upload completely sent off: 87 out of 87 bytes
<= Recv SSL data, 5 bytes (0x5)
0000: ....k
== Info: The requested URL returned error: 400 Bad Request
Further more; a standard line (with one new line at the end) does work normally.
What is the expected correct behavior?
201 Request accepted
Output of checks
This bug happens on GitLab.com
Edited by Olliver Schinagl