Skip to content

Empty string rejected for contentEncoding: base64 ([]byte) #1012

@amntam

Description

@amntam

First of all, thanks for the great package!

I noticed that the current Base64 validation uses:

var rxBase64 = regexp.MustCompile(`^[a-zA-Z0-9+/_-]+=*$`)

This rejects an empty string.

However, according to RFC 4648 an empty string is a valid Base64 encoding representing zero bytes, and Go’s standard library also accepts it.
Since Huma maps []byte to contentEncoding: base64, allowing "" here might make sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions