File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed
src/packages/jupyter/kernel Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -218,14 +218,6 @@ nodeCleanup(() => {
218
218
}
219
219
} ) ;
220
220
221
- // TODO: are these the only base64 encoded types that jupyter kernels return?
222
- export const BASE64_TYPES = [
223
- "image/png" ,
224
- "image/jpeg" ,
225
- "application/pdf" ,
226
- "base64" ,
227
- ] as const ;
228
-
229
221
// NOTE: keep JupyterKernel implementation private -- use the kernel function
230
222
// above, and the interface defined in types.
231
223
class JupyterKernel extends EventEmitter implements JupyterKernelInterface {
@@ -760,15 +752,14 @@ class JupyterKernel extends EventEmitter implements JupyterKernelInterface {
760
752
return await new CodeExecutionEmitter ( this , opts ) . go ( ) ;
761
753
} ;
762
754
763
- private saveBlob = ( data : string , type ? : string ) => {
755
+ private saveBlob = ( data : string , type : string ) => {
764
756
const blobs = this . _actions ?. blobs ;
765
757
if ( blobs == null ) {
766
758
throw Error ( "blob store not available" ) ;
767
759
}
768
- const buf : Buffer =
769
- type && BASE64_TYPES . includes ( type as any )
770
- ? Buffer . from ( data , "base64" )
771
- : Buffer . from ( data ) ;
760
+ const buf : Buffer = ! type . startsWith ( "text/" )
761
+ ? Buffer . from ( data , "base64" )
762
+ : Buffer . from ( data ) ;
772
763
773
764
const sha1 : string = misc_node_sha1 ( buf ) ;
774
765
blobs . set ( sha1 , buf ) ;
You can’t perform that action at this time.
0 commit comments