[go: up one dir, main page]

Cannot Create Secure File

Checklist

  • I'm using the latest version of the extension (Run glab --version)
    • Extension version: glab version 1.36.0
  • Operating system and version: Ubuntu 22.04.1 LTS
  • Gitlab.com or self-managed instance? self-managed instance
  • GitLab version (if self-managed) 6.6.5-ee (Use the version endpoint, like this: gitlab.my-company.com/api/v4/version)
  • I have performed glab auth status to check for authentication issues

Summary

glab CLI returns a 400 error when trying to create a secure file

Environment

  • OS: Linux 5.15.133.1-microsoft-standard-WSL2 x86_64
  • SHELL: /usr/bin/zsh
  • TERM: xterm-256color
  • GLAB: glab version 1.36.0

Other:

Steps to reproduce

echo "test" > test.txt
glab api -X POST  /projects/:id/secure_files \
		--field "name=test.txt" \
		--field "file=@test.txt"

What is the current bug behavior?

A secure file should be created instead a 400 error is returned

glab: HTTP 400
{
  "error": "file is invalid"
}

The same file and command using the API

curl --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
     "https://git.xxxx.xx/api/v4/projects/1058/secure_files"  --form "name=test.txt" --form "file=@test.txt"

returns:

{
  "id": 8,
  "name": "test.txt",
  "checksum": "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2",
  "checksum_algorithm": "sha256",
  "created_at": "2024-01-30T12:01:59.003Z",
  "expires_at": null,
  "metadata": null,
  "file_extension": "txt"
}

Relevant logs and/or screenshots

Possible fixes