File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
geojson-editor/src/components/features Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -91,20 +91,21 @@ async function handleDownload() {
9191 })),
9292 };
9393
94+ let writable: FileSystemWritableFileStream | undefined ;
9495 try {
9596 const handle: FileSystemFileHandle = await (window as any ).showSaveFilePicker (opts ); // 打开保存文件对话框
96- const writable: FileSystemWritableFileStream = await handle .createWritable (); // 创建可写入的文件对象
97+ writable = await handle .createWritable (); // 创建可写入的文件对象
9798
9899 const extension = handle .name .split (' .' ).pop ()! ;
99- let encode = file_process .find (x => x .extension === ` .${extension } ` )! .encode ;
100+ let encode = file_process .find (x => x .extension === ` .${extension } ` )? .encode ;
100101 if (! encode ) encode = file_process .find (x => x .extension === ' .geojson' )! .encode ! ;
101102
102- writable .write (encode (geojson )).then (()=> {
103- writable .close ();
103+ writable .write (encode (geojson )).then (() => {
104+ writable ? .close ();
104105 });
105106
106107 } catch (e ) {
107-
108+ writable ?. close ();
108109 }
109110 }
110111 else {
You can’t perform that action at this time.
0 commit comments