fix :editor

This commit is contained in:
math-pixel
2026-04-27 17:25:56 +02:00
parent 1a91fcaca0
commit bfe8c49323
3 changed files with 109 additions and 156 deletions
+28 -1
View File
@@ -282,8 +282,35 @@ export function EditorPage(): React.JSX.Element {
try {
const modelUrl = `/models/${modelName}/model.gltf`;
const modelResponse = await fetch(modelUrl);
if (modelResponse.ok) {
models.set(modelName, modelUrl);
const contentType =
modelResponse.headers.get("content-type") || "";
if (
contentType.includes("gltf") ||
contentType.includes("json") ||
contentType.includes("model")
) {
const text = await modelResponse.text();
if (
text.includes('"glTF"') ||
text.includes('"scene"') ||
text.includes('"nodes"')
) {
models.set(modelName, modelUrl);
} else {
console.warn(
`Invalid GLTF content for ${modelName}:`,
text.substring(0, 100),
);
}
} else {
console.warn(
`Invalid Content-Type for ${modelName}:`,
contentType,
);
}
}
} catch {
/* empty */