Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Dec 5, 2024
1 parent 1588c90 commit 06b4252
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/FormData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'node:path';
import _FormData from 'form-data';

// eslint-disable-next-line
const ASCII_RE = /[^\x00-\x7F]/i;
const NON_ASCII_RE = /[^\x00-\x7F]/i;

export class FormData extends _FormData {
_getContentDisposition(value: any, options: any) {
Expand All @@ -28,7 +28,7 @@ export class FormData extends _FormData {
// https://datatracker.ietf.org/doc/html/rfc6266#section-4.1
// support non-ascii filename
contentDisposition = 'filename="' + filename + '"';
if (ASCII_RE.test(filename)) {
if (NON_ASCII_RE.test(filename)) {
contentDisposition += '; filename*=UTF-8\'\'' + encodeURIComponent(filename);
}
}
Expand Down

0 comments on commit 06b4252

Please sign in to comment.