File tree Expand file tree Collapse file tree
src/ContentProcessorWeb/src/store/slices Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,8 +35,18 @@ export const fetchContentFileData = createAsyncThunk<
3535 const response = await httpUtility . headers ( url ) ;
3636
3737 if ( ! response . ok ) throw new Error ( "Failed to fetch file" ) ;
38+ // const blob = await response.blob();
39+ // const blobURL = URL.createObjectURL(blob);
40+ //The blob: URL is created in the top-level page context, then loaded inside an <iframe>.
41+ // Chrome's storage partitioning blocks cross-partition blob URL access,
42+ // causing the iframe to fail loading the PDF/document.
3843 const blob = await response . blob ( ) ;
39- const blobURL = URL . createObjectURL ( blob ) ;
44+ const blobURL = await new Promise < string > ( ( resolve ) => {
45+ const reader = new FileReader ( ) ;
46+ reader . onloadend = ( ) => resolve ( reader . result as string ) ;
47+ reader . readAsDataURL ( blob ) ;
48+ } ) ;
49+
4050 const headers = response . headers ;
4151 if ( ! headers ) {
4252 throw new Error ( "Failed to fetch headers" ) ;
You can’t perform that action at this time.
0 commit comments