Spaces:
Running
Running
Update index.html
Browse files- index.html +8 -2
index.html
CHANGED
@@ -24,14 +24,20 @@
|
|
24 |
|
25 |
// ファイル名を補正
|
26 |
let suggestedName = link.download || 'downloaded-file';
|
27 |
-
|
28 |
-
|
|
|
|
|
29 |
}
|
30 |
|
31 |
// ファイル保存ダイアログを表示
|
32 |
const handle = await window.showSaveFilePicker({
|
33 |
suggestedName: suggestedName,
|
34 |
types: [
|
|
|
|
|
|
|
|
|
35 |
{
|
36 |
description: 'All Files',
|
37 |
accept: { '*/*': ['.'] },
|
|
|
24 |
|
25 |
// ファイル名を補正
|
26 |
let suggestedName = link.download || 'downloaded-file';
|
27 |
+
|
28 |
+
// "."で終わる場合や拡張子がない場合に補正
|
29 |
+
if (suggestedName.endsWith('.') || !/\.[a-zA-Z0-9]+$/.test(suggestedName)) {
|
30 |
+
suggestedName = suggestedName.replace(/\.+$/, '') + '.html'; // "."を取り除き "html" を追加
|
31 |
}
|
32 |
|
33 |
// ファイル保存ダイアログを表示
|
34 |
const handle = await window.showSaveFilePicker({
|
35 |
suggestedName: suggestedName,
|
36 |
types: [
|
37 |
+
{
|
38 |
+
description: 'HTML File',
|
39 |
+
accept: { 'text/html': ['.html'] },
|
40 |
+
},
|
41 |
{
|
42 |
description: 'All Files',
|
43 |
accept: { '*/*': ['.'] },
|