Skip to content

Do not emit filename* in multipart/form-data parts #1478

Open

Description

@He-Pin

Current behavior

When Pekko HTTP serializes a Multipart.FormData.BodyPart with a non-ASCII filename, it uses the shared Content-Disposition renderer. That renderer emits both an ASCII fallback (with unsupported characters replaced by ?) and a filename* parameter. Both strict and streamed multipart serialization use this renderer.

This was confirmed by source inspection on main; no runtime test was run.

Expected behavior

RFC 7578 §4.2 prohibits sending filename* in multipart/form-data part headers. The multipart sender should preserve non-ASCII filenames via a compatible filename encoding rather than simply dropping filename* and keeping a lossy fallback.

Scope the change to outgoing form data. Preserve existing inbound compatibility and the extended filename behavior for ordinary HTTP attachment headers. Add strict and streamed serialization tests, including a non-ASCII filename and an attachment control.

Related: akka/akka-http#4410.

Activity

  1. pjfanning commented on Nov 16, 2026

    @pjfanning
    Member

    I think this needs to be configurable.
    We don't have any reports of the current code causing issues and many external services may not follow the spec exactly.
    The configs options needed could be

    • add filename*
    • send just filename with non-ASCII chars replaced by ?
    • percent encoded filename
  2. added this to the 2.1.0 milestone on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions