millas 0.2.17 → 0.2.18
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.
package/package.json
CHANGED
|
@@ -102,8 +102,10 @@ class RequestContext {
|
|
|
102
102
|
// Uploaded files (populated by multer or similar middleware)
|
|
103
103
|
// req.files → multi-file upload { avatar: File, resume: File }
|
|
104
104
|
// req.file → single-file upload (multer .single())
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
// Prefer UploadedFile-wrapped instances set by UploadMiddleware (_millaFile/_millaFiles).
|
|
106
|
+
// Fall back to raw multer objects only if UploadMiddleware hasn't run.
|
|
107
|
+
this.file = millaReq.raw._millaFile || millaReq.raw.file || null;
|
|
108
|
+
this.files = millaReq.raw._millaFiles || millaReq.raw.files || {};
|
|
107
109
|
|
|
108
110
|
// ── headers ───────────────────────────────────────────────────────────────
|
|
109
111
|
this.headers = millaReq.raw.headers || {};
|
|
@@ -121,7 +121,7 @@ class UploadMiddleware {
|
|
|
121
121
|
*/
|
|
122
122
|
async handle(ctx, next) {
|
|
123
123
|
const expressReq = ctx.req.raw;
|
|
124
|
-
const contentType =
|
|
124
|
+
const contentType = ctx.headers?.['content-type'] || '';
|
|
125
125
|
|
|
126
126
|
// Skip multer entirely for non-multipart requests.
|
|
127
127
|
// ctx.file / ctx.files stay null/{} — the handler or shape validation
|