You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 571c99c
Browse filesBrowse the repository at this point in the historyBrowse files
fix(sdk): read a composition's variables from its root when its html has none (#4454)
* fix(sdk): read a composition's variables from its root when its html has none
* fix: composition metadata and lint also read variables declared on the root
* fix(sdk): keep root declarations on the root through undo and prefer them like the runtime
* fix(sdk): read variables from both <html> and the root, editing each where declared
message: `data-composition-variables entry [${i}] is missing or has invalid: ${missing.join(", ")}. Type must be one of string, number, color, boolean, enum, font, image.`,
457
+
snippet: truncateSnippet(tag.raw),
458
+
});
459
+
continue;
460
+
}
461
+
constid=String(e.id);
462
+
if(
463
+
(e.type==="image"||varSrcIds.has(id))&&
464
+
typeofe.default==="string"&&
465
+
e.default.length>0&&
466
+
!isSafeMediaUrl(e.default)
467
+
){
468
+
findings.push({
469
+
code: "unloadable_media_variable_default",
470
+
severity: "error",
471
+
message: `Variable "${id}" defaults to a URL the runtime will refuse to load, so any element bound to it renders its authored fallback src instead and the render still exits 0.`,
472
+
fixHint: `Media URLs must be relative, http(s), blob:, or a data:image/* URI. Copy the file into the project and reference it relatively (e.g. "assets/bg.png") rather than by absolute path.`,
message: `data-composition-variables entry [${i}] is missing or has invalid: ${missing.join(", ")}. Type must be one of string, number, color, boolean, enum, font, image.`,
1083
-
snippet: truncateSnippet(htmlTag.raw),
1084
-
});
1085
-
continue;
1086
-
}
1087
-
constid=String(e.id);
1088
-
if(
1089
-
(e.type==="image"||varSrcIds.has(id))&&
1090
-
typeofe.default==="string"&&
1091
-
e.default.length>0&&
1092
-
!isSafeMediaUrl(e.default)
1093
-
){
1094
-
findings.push({
1095
-
code: "unloadable_media_variable_default",
1096
-
severity: "error",
1097
-
message: `Variable "${id}" defaults to a URL the runtime will refuse to load, so any element bound to it renders its authored fallback src instead and the render still exits 0.`,
1098
-
fixHint: `Media URLs must be relative, http(s), blob:, or a data:image/* URI. Copy the file into the project and reference it relatively (e.g. "assets/bg.png") rather than by absolute path.`,
1099
-
snippet: truncateSnippet(htmlTag.raw),
1100
-
});
1101
-
}
1102
-
}
1103
-
returnfindings;
1104
-
},
1107
+
// Checked on every element that declares: <html>, or the composition root.
0 commit comments