FIX: Remove wrong content-type is sharing workbooks
This failed to share workbooks with emojis, for instance
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
3a68145848
commit
198f3108ef
@@ -17,8 +17,7 @@ function ShareWorkbookDialog(properties: {
|
|||||||
const generateUrl = async () => {
|
const generateUrl = async () => {
|
||||||
if (properties.model) {
|
if (properties.model) {
|
||||||
const bytes = properties.model.toBytes();
|
const bytes = properties.model.toBytes();
|
||||||
const fileName = properties.model.getName();
|
const hash = await shareModel(bytes);
|
||||||
const hash = await shareModel(bytes, fileName);
|
|
||||||
setUrl(`${location.origin}/?model=${hash}`);
|
setUrl(`${location.origin}/?model=${hash}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -81,15 +81,11 @@ export async function downloadModel(bytes: Uint8Array, fileName: string) {
|
|||||||
a.remove();
|
a.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function shareModel(
|
export async function shareModel(bytes: Uint8Array): Promise<string> {
|
||||||
bytes: Uint8Array,
|
|
||||||
fileName: string,
|
|
||||||
): Promise<string> {
|
|
||||||
const response = await fetch("/api/share", {
|
const response = await fetch("/api/share", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/octet-stream",
|
"Content-Type": "application/octet-stream",
|
||||||
"Content-Disposition": `attachment; filename="${fileName}"`,
|
|
||||||
},
|
},
|
||||||
body: bytes,
|
body: bytes,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user