From 2472874e4994aa64998206be16d0ce326f4e5ec1 Mon Sep 17 00:00:00 2001 From: lyyh3c Date: Thu, 30 Mar 2017 21:06:24 +0800 Subject: [PATCH 1/3] to solve EISDIR error to solve EISDIR error when trying to submit a form with no file selected. --- .idea/.name | 1 + .idea/misc.xml | 14 +++ .idea/modules.xml | 8 ++ .idea/node-formidable.iml | 8 ++ .idea/vcs.xml | 6 ++ .idea/workspace.xml | 182 ++++++++++++++++++++++++++++++++++++++ lib/incoming_form.js | 2 +- 7 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 .idea/.name create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/node-formidable.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 00000000..723edd2e --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +node-formidable \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..19f74da8 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..85e7bec3 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/node-formidable.iml b/.idea/node-formidable.iml new file mode 100644 index 00000000..c956989b --- /dev/null +++ b/.idea/node-formidable.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..51f81bdd --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1490877793355 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/incoming_form.js b/lib/incoming_form.js index 9fffa48f..7f2beff2 100644 --- a/lib/incoming_form.js +++ b/lib/incoming_form.js @@ -182,7 +182,7 @@ IncomingForm.prototype.onPart = function(part) { IncomingForm.prototype.handlePart = function(part) { var self = this; - if (part.filename === undefined) { + if (part.filename === undefined || part.filename === '') { var value = '' , decoder = new StringDecoder(this.encoding); From 069930930589f8e6f27b288fbba33eef1bf65ece Mon Sep 17 00:00:00 2001 From: lyyh3c Date: Thu, 30 Mar 2017 23:08:58 +0800 Subject: [PATCH 2/3] del .ideal and modify incoming_form remove needless .idea things and change the condition to !part.filename --- .idea/.name | 1 - .idea/misc.xml | 14 ----- .idea/modules.xml | 8 --- .idea/node-formidable.iml | 8 --- .idea/vcs.xml | 6 --- .idea/workspace.xml | 110 ++++++++++++++++++++++++++++++++------ lib/incoming_form.js | 2 +- 7 files changed, 96 insertions(+), 53 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/node-formidable.iml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 723edd2e..00000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -node-formidable \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 19f74da8..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 85e7bec3..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/node-formidable.iml b/.idea/node-formidable.iml deleted file mode 100644 index c956989b..00000000 --- a/.idea/node-formidable.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 51f81bdd..682fb039 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -24,8 +24,18 @@ - - + + + + + + + + + + + + @@ -39,6 +49,7 @@ @@ -80,6 +91,7 @@ + @@ -114,7 +126,6 @@ - @@ -123,13 +134,58 @@ + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -145,23 +201,31 @@ - - - + + + + - - + + + - - - + + - + + + + @@ -172,8 +236,24 @@ - - + + + + + + + + + + + + + + + + + + diff --git a/lib/incoming_form.js b/lib/incoming_form.js index 7f2beff2..8eed298c 100644 --- a/lib/incoming_form.js +++ b/lib/incoming_form.js @@ -182,7 +182,7 @@ IncomingForm.prototype.onPart = function(part) { IncomingForm.prototype.handlePart = function(part) { var self = this; - if (part.filename === undefined || part.filename === '') { + if (!part.filename) { var value = '' , decoder = new StringDecoder(this.encoding); From 7f05ea2d0c2efd07539336f443893820fb4e96ce Mon Sep 17 00:00:00 2001 From: lyyh3c Date: Thu, 30 Mar 2017 23:16:27 +0800 Subject: [PATCH 3/3] remove needless .idea remove needless .idea --- .idea/workspace.xml | 262 -------------------------------------------- 1 file changed, 262 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 682fb039..00000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1490877793355 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file