You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support reading percent-encoded multipart/form-data filenames on the server #1496
When a server receives a multipart/form-data part, Multipart.FormData.BodyPart.filename (Java: getFilename) returns the raw filename parameter. An RFC 5987 filename* parameter is decoded and replaces filename, but a percent-encoded plain filename is returned as-is.
RFC 7578 section 4.2 forbids filename* in form-data and allows senders to percent-encode non-ASCII filenames in the plain filename parameter instead. Such a part, e.g. filename="caf%C3%A9.txt", is exposed as the literal caf%C3%A9.txt, and Pekko HTTP has no way to recover café.txt.
#1494 adds an outgoing PercentEncoded filename option to the client side, so without matching server-side support, Pekko client to Pekko server does not round-trip.
Expected behavior
Applications should be able to opt in to reading a percent-decoded filename. This cannot be the default, because a literal % is valid in filenames (browsers do not encode it), so decoding every value would change existing names such as 100%25.txt.
Suggested scope:
An opt-in accessor on the Scala and Java form-data body part that returns the UTF-8 percent-decoded filename.
Fall back to the raw filename when the value is not valid percent-encoded UTF-8 (e.g. 100%.txt).
Keep filename / getFilename unchanged.
Document that the decoded value is untrusted client input and should not be used as a file system path without sanitizing it.
Activity
feat: add opt-in percent-decoded multipart filename accessor
feat: add opt-in percent-decoded multipart filename accessor (apache#…