Uploading a crc.txt file via API on Package manager writes inside the file

I’m using the API to Publish a crc.txt file as a package in the Package Registry.

The file contains only a CRC-32 value in the form of 1c46a94d.

I’ve just found out that downloading the file, it seems GitLab writes inside the crc.txt like

------WebKitFormBoundarytOsm3n7WbWZKCATg
Content-Disposition: form-data; name="file"; filename="crc.txt"
Content-Type: text/plain

1c46a94d
------WebKitFormBoundarytOsm3n7WbWZKCATg--

why? can I avoid it?

GitLab Enterprise Edition 15.5.4-ee

It turned out that the issue was on the var formData = new FormData();formData.append("file", select_file); code.

The formData not only upload the data, but serialize other information into the file, corrupting it.

Passing the file directly with

      fetch(file_string, {
        method: "PUT",
        headers: {
          "PRIVATE-TOKEN": GITTOKEN,
        },
        body: select_file,
      })

worked