Skip to content

Add reusable file upload decode helper#797

Draft
gontzess wants to merge 2 commits into
mainfrom
gontzess/file-upload-decode-helper
Draft

Add reusable file upload decode helper#797
gontzess wants to merge 2 commits into
mainfrom
gontzess/file-upload-decode-helper

Conversation

@gontzess
Copy link
Copy Markdown
Contributor

@gontzess gontzess commented May 4, 2026

Why

Callers outside mapstructure need the SDK's file-upload decode behavior without duplicating base64 and data URL parsing. The helper uses explicit modes so path reads are opt-in rather than inferred from arbitrary strings.

What this changes

Adds DecodeFileUploadValue with content-only and path-only modes, plus an optional decoded-size limit for content mode.
Reuses the helper from FileUploadDecodeHook to keep existing hook behavior.
Keeps data URL handling limited to application/json base64 and adds focused tests.

Validation

go test -tags=baton_lambda_support -v ./pkg/field
go vet -tags=baton_lambda_support ./pkg/field
golangci-lint run --timeout=3m ./pkg/field (blocked locally: no go files to analyze before linting)

@gontzess gontzess force-pushed the gontzess/file-upload-decode-helper branch from b0266c1 to 49479c3 Compare May 4, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant