Skip to content

escapeHeaderFilename

escapeHeaderFilename(filename): string

Defined in: multipart.ts:53

Escape a filename for inclusion in a Content-Disposition header.

Applies the same normalization the WHATWG FormData serializer does. Without it, a file named my"file.pdf would close the quoted string early, and one containing a newline could inject a header. The form-data package this replaced did neither.

string

The raw filename.

string

The filename with ", CR, and LF percent-encoded.