File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,9 +114,15 @@ ${humanFileSize(uploadedBytes)} of ${humanFileSize(totalBytes)}`,
114114
115115 const filePath = getFilePath ( targetPath , file ) ;
116116 const dataURLResponse = await readAsDataURL ( file ) ;
117- const dataURLResult = dataURLResponse . target ! . result as string ;
117+ const dataURLResult = dataURLResponse . target ?. result as string | undefined ;
118+ if ( ! dataURLResult ) {
119+ throw new Error ( `Failed to read file: ${ file . name } ` ) ;
120+ }
118121 const demarcation = 'base64,' ;
119122 const encodingIndex = dataURLResult . indexOf ( demarcation ) ;
123+ if ( encodingIndex === - 1 ) {
124+ throw new Error ( `Invalid data URL format for file: ${ file . name } ` ) ;
125+ }
120126 if ( ! canceled ) {
121127 await setComponentFile ( {
122128 ...instanceParams ,
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
4949import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker' ;
5050import yamlWorker from 'monaco-yaml/yaml.worker?worker' ;
5151
52- const globalScope = self as unknown as { MonacoEnvironment ?: monaco . Environment } ;
52+ const globalScope = globalThis as unknown as { MonacoEnvironment ?: monaco . Environment } ;
5353
5454globalScope . MonacoEnvironment = {
5555 getWorker ( _workerId : string , label : string ) : Worker {
You can’t perform that action at this time.
0 commit comments