File tree Expand file tree Collapse file tree
src/common/attachment-drafts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -238,7 +238,11 @@ export function useAttachmentDrafts(attachmentsStoreApi: AttachmentDraftsStoreAp
238238 for ( const clipboardItem of clipboardItems ) {
239239
240240 // https://github.com/enricoros/big-AGI/issues/286
241- const textHtml = clipboardItem . types . includes ( 'text/html' ) ? await clipboardItem . getType ( 'text/html' ) . then ( blob => blob . text ( ) ) : '' ;
241+ const textHtml = clipboardItem . types . includes ( 'text/html' )
242+ ? await clipboardItem . getType ( 'text/html' )
243+ . then ( blob => blob ?. text ( ) ?? '' )
244+ . catch ( ( ) => '' )
245+ : '' ;
242246 const heuristicBypassImage = textHtml . startsWith ( '<table ' ) ;
243247
244248 if ( ATTACHMENTS_DEBUG_INTAKE )
@@ -269,7 +273,11 @@ export function useAttachmentDrafts(attachmentsStoreApi: AttachmentDraftsStoreAp
269273 }
270274
271275 // get the Plain text
272- const textPlain = clipboardItem . types . includes ( 'text/plain' ) ? await clipboardItem . getType ( 'text/plain' ) . then ( blob => blob . text ( ) ) : '' ;
276+ const textPlain = clipboardItem . types . includes ( 'text/plain' )
277+ ? await clipboardItem . getType ( 'text/plain' )
278+ . then ( blob => blob ?. text ( ) ?? '' )
279+ . catch ( ( ) => '' )
280+ : '' ;
273281
274282 // attach as URL
275283 if ( textPlain && enableLoadURLsOnPaste ) {
You can’t perform that action at this time.
0 commit comments