structured-fw 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -351,12 +351,17 @@ export class Request {
|
|
|
351
351
|
static parseBodyMultipart(bodyRaw, boundary) {
|
|
352
352
|
const pairsRaw = bodyRaw.split(boundary);
|
|
353
353
|
const pairs = pairsRaw.map((pair) => {
|
|
354
|
-
const parts =
|
|
355
|
-
if (parts) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
354
|
+
const parts = pair.split(/\r?\n\r?\n/, 2).filter((part) => { return part.length > 0; });
|
|
355
|
+
if (parts.length > 0) {
|
|
356
|
+
const header = parts[0];
|
|
357
|
+
const data = typeof parts[1] === 'string' ? parts[1].trim() : '';
|
|
358
|
+
const headerParts = /Content-Disposition: form-data; name="([^\r\n"]+)"/m.exec(header);
|
|
359
|
+
if (headerParts) {
|
|
360
|
+
return {
|
|
361
|
+
key: headerParts[1],
|
|
362
|
+
value: data
|
|
363
|
+
};
|
|
364
|
+
}
|
|
360
365
|
}
|
|
361
366
|
return null;
|
|
362
367
|
});
|
|
@@ -103,7 +103,9 @@ export class HTMLParser {
|
|
|
103
103
|
throw this.error(`Found closing tag ${this.tokenCurrent}, expected ${this.context.tagName}`);
|
|
104
104
|
}
|
|
105
105
|
this.context = this.context.parentNode || this.fragment;
|
|
106
|
-
this.state = '
|
|
106
|
+
this.state = 'text';
|
|
107
|
+
this.tokenCurrent = '';
|
|
108
|
+
return true;
|
|
107
109
|
}
|
|
108
110
|
this.tokenCurrent += char;
|
|
109
111
|
}
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"main": "build/index",
|
|
22
|
-
"version": "1.0.
|
|
22
|
+
"version": "1.0.4",
|
|
23
23
|
"scripts": {
|
|
24
24
|
"develop": "tsc --watch",
|
|
25
25
|
"startDev": "cd build && nodemon --watch '../app/**/*' --watch '../build/**/*' -e js,html,css index.js",
|