neurastream 0.2.33 → 0.2.34
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 +1 -1
- package/src/core/owner-ui.ts +5 -1
package/package.json
CHANGED
package/src/core/owner-ui.ts
CHANGED
|
@@ -1137,7 +1137,11 @@ async function handleMessage(req: Request, login: string, wantsJson: boolean): P
|
|
|
1137
1137
|
const files: File[] = [];
|
|
1138
1138
|
for (const [key, value] of form.entries()) {
|
|
1139
1139
|
if (key === "text" && typeof value === "string") text = value.trim();
|
|
1140
|
-
|
|
1140
|
+
// A form sent with no file chosen still carries one empty, nameless file part (Bun parses it as a nameless Blob).
|
|
1141
|
+
else if (key === "images" && (value as unknown) instanceof Blob) {
|
|
1142
|
+
const part = value as unknown as File;
|
|
1143
|
+
if (part.size > 0 || Boolean(part.name)) files.push(part);
|
|
1144
|
+
}
|
|
1141
1145
|
}
|
|
1142
1146
|
const fail = (error: string): Response => (wantsJson ? jsonFail(error, 400) : textRes(error, 400));
|
|
1143
1147
|
if (!text && !files.length) return fail("write a text or attach an image");
|