File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
packages/kitten-scientists/source/state Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import { StateLoader } from "./StateLoader.js";
5
5
import { StateMerger } from "./StateMerger.js" ;
6
6
7
7
export class State extends TreeNode < State > {
8
+ static ALLOW_DATA_URL_IMPORT = false ;
9
+
8
10
readonly originUrl : string ;
9
11
10
12
readonly loader : StateLoader ;
@@ -16,9 +18,12 @@ export class State extends TreeNode<State> {
16
18
constructor ( originUrl : string , parent ?: State ) {
17
19
super ( parent ) ;
18
20
if ( ! originUrl . startsWith ( "https://kitten-science.com/" ) ) {
19
- throw new InvalidOperationError (
20
- "While state import is experimental, you can only import from 'https://kitten-science.com/'!" ,
21
- ) ;
21
+ // Make an exception for data URLs, if the exception was explicitly allowed.
22
+ if ( ! originUrl . startsWith ( "data:" ) || ! State . ALLOW_DATA_URL_IMPORT ) {
23
+ throw new InvalidOperationError (
24
+ "While state import is experimental, you can only import from 'https://kitten-science.com/'!" ,
25
+ ) ;
26
+ }
22
27
}
23
28
24
29
this . originUrl = originUrl ;
You can’t perform that action at this time.
0 commit comments