fix(anatomy): V1-2.2 owner arbitrations on SVG references and bytes

Refuse local references to ids a drawing does not define, scope canvas
ids per view, upload every drawing in one stored form checked by the
verdict and the preview, keep strict numeric rgb() colours, and commit
real Inkscape 1.4.3 exports with their generator.
This commit is contained in:
bchanot committed 2026-10-29 16:24:07 +01:00
1 parent 17d919971e
commit e823655f09
31 files changed
+1362 -110

No files matched your search

+24
View File
@@ -67,6 +67,30 @@ pub fn with_trigger_names_per_language(tree: &mut Value, views: &[(String, Strin
}
}
/// Owner decision 2026-10-29 (V1-2.2): the canvas, inlined in the page, scopes the drawing's
/// ids and the references to them to its view (`fv.<view>.<id>`). Applied to a frozen canvas
/// tree before comparing, written apart from the core's rewrite: every `id`, every `#id`
/// href and every plain `url(#` (the only spelling of the product drawing).
pub fn with_ids_scoped_per_view(tree: &mut Value, view_id: &str) {
let scope = format!("fv.{view_id}.");
if let Some(attrs) = tree.get_mut("attrs").and_then(Value::as_object_mut) {
for (name, value) in attrs.iter_mut() {
let Some(text) = value.as_str() else { continue };
let scoped = match name.as_str() {
"id" => format!("{scope}{text}"),
"href" | "xlink:href" if text.starts_with('#') => format!("#{scope}{}", &text[1..]),
_ => text.replace("url(#", &format!("url(#{scope}")),
};
*value = Value::String(scoped);
}
}
if let Some(children) = tree.get_mut("children").and_then(Value::as_array_mut) {
for child in children {
with_ids_scoped_per_view(child, view_id);
}
}
}
/// (view id, FR name, EN name) of a document, for `with_trigger_names_per_language`.
pub fn view_names(
document: &faunosteo_core::domain::sheet::AnatomicalSheetDocument,