Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If policy file is empty, mc requests the user provides a Content-Length header #5108

Closed
MrCreosote opened this issue Jan 15, 2025 · 0 comments · Fixed by minio/madmin-go#326 or #5109
Closed
Assignees

Comments

@MrCreosote
Copy link

MrCreosote commented Jan 15, 2025

Expected behavior

When attempting to create a policy with the mc client, a empty policy document should cause the client to error out with a helpful error message.

Actual behavior

The mc client tells the user to provide a Content-Length header, which is not very helpful to the user, especially a newbie.

Steps to reproduce the behavior

~$ cat badpolicy.json 
~$ ~/minio/mc/RELEASE/2024-11-21T17-21-54Z/mc admin policy create local9000 badpolicy badpolicy.json
mc: <ERROR> Unable to create new policy. You must provide the Content-Length HTTP header.

mc --version

~$ ~/minio/mc/RELEASE/2024-11-21T17-21-54Z/mc admin info local9000
●  localhost:9000
   Uptime: 3 minutes 
   Version: 2024-12-18T13:15:44Z
*snip*
~$ ~/minio/mc/RELEASE/2024-11-21T17-21-54Z/mc -v
mc version RELEASE.2024-11-21T17-21-54Z (commit-id=1681e4497c09d7438a34e846f76dbde972ab7daf)
Runtime: go1.23.4 linux/amd64
Copyright (c) 2015-2024 MinIO, Inc.
License GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>

System information

Ubuntu 18 VM running on an Ubuntu 18 laptop. Upgrade plans are in motion

Other notes

I haven't tested with malformed JSON or valid JSON but mismatched with the policy schema - not sure what error messages those might return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants