From 7a9f80a40fbdf94e14cb91628b995e5a74dbf3c1 Mon Sep 17 00:00:00 2001 From: Jarsen <31397967+Jarsen136@users.noreply.github.com> Date: Mon, 16 Sep 2024 21:14:07 +0200 Subject: [PATCH] fix: make sure index.html exist on root of the folder --- components/codeChecker/CodeChecker.vue | 5 +++++ components/codeChecker/utils.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/codeChecker/CodeChecker.vue b/components/codeChecker/CodeChecker.vue index 40d205d5fe..393e137130 100644 --- a/components/codeChecker/CodeChecker.vue +++ b/components/codeChecker/CodeChecker.vue @@ -282,6 +282,11 @@ const onFileSelected = async (file: File) => { const { indexFile, sketchFile, entries } = await extractAssetsFromZip(file) + if (!indexFile) { + errorMessage.value = `Index file not found: Please make sure that “index.html” is in the root directory` + return + } + if (!sketchFile) { errorMessage.value = `Sketch file not found: ${config.sketchFile}` return diff --git a/components/codeChecker/utils.ts b/components/codeChecker/utils.ts index b5659a8bea..b0f0778041 100644 --- a/components/codeChecker/utils.ts +++ b/components/codeChecker/utils.ts @@ -92,7 +92,7 @@ const categorizeFiles = async ( const adjustedPath = path.replace(commonPrefix, '') const content = await file.text() - if (path.endsWith('index.html')) { + if (path === 'index.html') { htmlFiles.push({ path: adjustedPath, content }) } else if (path.endsWith('.js') && !path.includes(config.p5)) {