Skip to content

Commit 88a341a

Browse files
author
Shreyas-Microsoft
committed
Update Web code as per the devops repo
1 parent 5bdc14e commit 88a341a

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/ContentProcessorWeb/src/store/slices/rightPanelSlice.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff 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");

0 commit comments

Comments
 (0)