File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
src/packages/jupyter/blobs Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ import { decode } from "he";
13
13
//import { getLogger } from "@cocalc/backend/logger";
14
14
//const logger = getLogger("jupyter:blobs:iframe");
15
15
16
+ // see https://github.com/sagemathinc/cocalc/issues/4322
17
+ const MAX_HTML_SIZE = 10 ** 6 ;
18
+
16
19
// We use iframes to render html in a number of cases:
17
20
// - if it starts with iframe
18
21
// - if it has a whole page doctype
@@ -26,6 +29,18 @@ export function is_likely_iframe(content: string): boolean {
26
29
return false ;
27
30
}
28
31
content = content . toLowerCase ( ) ;
32
+ if (
33
+ content . includes ( "https://bokeh.org" ) &&
34
+ content . includes ( "bk-notebook-logo" )
35
+ ) {
36
+ // Do NOT use an iframe for bokeh no matter what, since this won't work properly.
37
+ // Hopefully the above heuristic is sufficiently robust to detect but not overdetect.
38
+ return false ;
39
+ }
40
+ if ( content . length >= MAX_HTML_SIZE ) {
41
+ // it'll just break anyways if we don't use an iframe -- if we do, there is hope.
42
+ return true ;
43
+ }
29
44
return (
30
45
content . includes ( "bk-notebook-logo" ) ||
31
46
content . startsWith ( "<iframe" ) ||
You can’t perform that action at this time.
0 commit comments