Skip to content

Commit 57906db

Browse files
committed
less strict about filename
closes #43
1 parent 008b5c3 commit 57906db

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

FormData.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ if (!window.FormData || !window.FormData.prototype.keys) {
2020
const stringTag = window.Symbol && Symbol.toStringTag
2121
const map = new WeakMap
2222
const wm = o => map.get(o)
23-
const type = obj => obj.toString().slice(8, -1)
2423
const arrayFrom = Array.from || (obj => [].slice.call(obj))
2524

2625
// Add missing stringTags to blob and files
@@ -98,7 +97,7 @@ if (!window.FormData || !window.FormData.prototype.keys) {
9897
// normalize name and filename if adding an attachment
9998
? [name + '', value, filename !== undefined
10099
? filename + '' // Cast filename to string if 3th arg isn't undefined
101-
: type(value) === 'File' // if it's a File
100+
: typeof value.name === 'string' // if name prop exist
102101
? value.name // Use File.name
103102
: 'Blob'] // otherwise fallback to Blob
104103

formdata.min.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "formdata-polyfill",
3-
"version": "3.0.8",
3+
"version": "3.0.9",
44
"description": "HTML5 `FormData` polyfill for Browsers.",
55
"main": "formdata.min.js",
66
"scripts": {

0 commit comments

Comments
 (0)