diff --git a/assets/webui/index.html b/assets/webui/index.html index 7ed90d0..89c18d0 100644 --- a/assets/webui/index.html +++ b/assets/webui/index.html @@ -9,7 +9,7 @@
- +
diff --git a/assets/webui/ofdgo.js b/assets/webui/ofdgo.js index 8c97168..71e15de 100644 --- a/assets/webui/ofdgo.js +++ b/assets/webui/ofdgo.js @@ -361,6 +361,11 @@ async function openSelectedOFD() { if (!file) { return; } + if (!isOFDFile(file)) { + el.ofdInput.value = ""; + showError(new Error("请选择 .ofd 文件"), !state.doc); + return; + } state.wasmRecoveries = 0; setBusy(true, "正在读取 OFD", 10, STATUS.opening); try { @@ -373,6 +378,10 @@ async function openSelectedOFD() { } } +function isOFDFile(file) { + return /\.ofd$/i.test(file.name || ""); +} + async function openSelectedFonts() { const files = Array.from(el.fontInput.files || []); if (!files.length) {