mirror of
https://github.com/hoornet/vega.git
synced 2026-07-29 19:28:11 -07:00
Bump to v0.12.7 — fix NIP-96 upload endpoints, block SVG uploads
This commit is contained in:
@@ -97,9 +97,14 @@ export function ComposeBox({ onPublished, onNoteInjected }: { onPublished?: () =
|
||||
const bytes = await readFile(filePath);
|
||||
const fileName = filePath.split(/[\\/]/).pop() || "file";
|
||||
const ext = fileName.split(".").pop()?.toLowerCase() || "";
|
||||
if (ext === "svg") {
|
||||
setError("SVG files are not supported — please use PNG or JPG.");
|
||||
setUploading(false);
|
||||
return;
|
||||
}
|
||||
const mimeMap: Record<string, string> = {
|
||||
jpg: "image/jpeg", jpeg: "image/jpeg", png: "image/png", gif: "image/gif",
|
||||
webp: "image/webp", svg: "image/svg+xml", mp4: "video/mp4", webm: "video/webm",
|
||||
webp: "image/webp", mp4: "video/mp4", webm: "video/webm",
|
||||
mov: "video/quicktime", ogg: "video/ogg", m4v: "video/mp4",
|
||||
};
|
||||
const mimeType = mimeMap[ext] || "application/octet-stream";
|
||||
@@ -160,7 +165,7 @@ export function ComposeBox({ onPublished, onNoteInjected }: { onPublished?: () =
|
||||
const selected = await open({
|
||||
multiple: false,
|
||||
filters: [
|
||||
{ name: "Media", extensions: ["jpg", "jpeg", "png", "gif", "webp", "svg", "mp4", "webm", "mov", "ogg", "m4v"] },
|
||||
{ name: "Media", extensions: ["jpg", "jpeg", "png", "gif", "webp", "mp4", "webm", "mov", "ogg", "m4v"] },
|
||||
],
|
||||
});
|
||||
if (!selected) return;
|
||||
|
||||
@@ -48,6 +48,10 @@ export function InlineReplyBox({ event, name, rootEvent }: InlineReplyBoxProps)
|
||||
};
|
||||
|
||||
const handleImageUpload = async (file: File) => {
|
||||
if (file.type === "image/svg+xml") {
|
||||
setUploadError("SVG files are not supported — please use PNG or JPG.");
|
||||
return;
|
||||
}
|
||||
setUploading(true);
|
||||
setUploadError(null);
|
||||
try {
|
||||
|
||||
@@ -9,6 +9,11 @@ export function ImageField({ label, value, onChange }: { label: string; value: s
|
||||
const handleFile = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file) return;
|
||||
if (file.type === "image/svg+xml") {
|
||||
setUploadError("SVG files are not supported — please use PNG or JPG.");
|
||||
if (fileRef.current) fileRef.current.value = "";
|
||||
return;
|
||||
}
|
||||
setUploading(true);
|
||||
setUploadError(null);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user