Skip to content

Commit 89bfe91

Browse files
alex-ArcDoc999tor
andauthored
🤖 Merge PR DefinitelyTyped#74638 expressjs_multer/support-for-unicode-headers by @alex-Arc
Co-authored-by: Victor <doc999tor@gmail.com>
1 parent c3d5fa8 commit 89bfe91

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

‎types/multer/index.d.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ declare namespace multer {
211211
} | undefined;
212212
/** Preserve the full path of the original filename rather than the basename. (Default: false) */
213213
preservePath?: boolean | undefined;
214+
/**
215+
* For multipart forms, the default character set to use for values of
216+
* part header parameters (e.g. filename) that are not extended
217+
* parameters (that contain an explicit charset). (Default: latin1)
218+
*/
219+
defParamCharset?: string | undefined;
214220
/**
215221
* Optional function to control which files are uploaded. This is called
216222
* for every file that is processed.

‎types/multer/multer-tests.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ const upload = multer({
1515
upload; // $ExpectType Multer
1616
assert.strictEqual(upload.constructor.name, "Multer");
1717

18+
const upload_with_defParamCharset = multer({
19+
dest: "uploads/",
20+
fileFilter: (req, file, cb) => {
21+
cb(null, false);
22+
cb(null, true);
23+
cb(new Error(`I don't have a clue!`));
24+
},
25+
defParamCharset: "utf8",
26+
});
27+
28+
upload_with_defParamCharset; // $ExpectType Multer
29+
assert.strictEqual(upload_with_defParamCharset.constructor.name, "Multer");
30+
1831
const app = express();
1932

2033
app.post(

‎types/multer/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/multer",
4-
"version": "2.0.9999",
4+
"version": "2.1.9999",
55
"projects": [
66
"https://github.com/expressjs/multer"
77
],

0 commit comments

Comments
 (0)