feat(domain): R4.3a FileBytes sink and the bytes entries of the wasm facade
FileBytes gathers a file chunk by chunk in linear memory (capacity reserved from the announced size, refused above the PDF cap); SheetHandle.import_pdf_bytes and restore_copy_bytes consume it, so the worker streams file.stream() and the file lives once, never as a JavaScript ArrayBuffer nor as a JSON-wrapped string. restore_copy: strict UTF-8, one BOM, the OD-3 budget, draft.restore's kinds. Node: same envelopes as import_pdf on the 51 O8 cases; rescue-copy parity with draft.restore.
This commit is contained in:
1 parent
f41dd59b2c
commit
52471dbbc0
5 files changed
+166
-12
No files matched your search
+12
-7
@@ -323,16 +323,21 @@ fn draft_restore(sheet: &LoadedSheet, input: &str) -> Outcome {
|
||||
return Err(Failure::new("invalid", "json value budget exceeded"));
|
||||
}
|
||||
session::restore_draft(sheet, &input.draft, input.archive.as_deref())
|
||||
.map_err(|failure| match failure {
|
||||
RestoreFailure::UnsupportedVersion(found) => versioned("unsupported_version", found),
|
||||
RestoreFailure::LoneSurrogate(detail) => Failure::new("lone_surrogate", detail),
|
||||
RestoreFailure::Invalid(detail) => Failure::new("invalid", detail),
|
||||
RestoreFailure::Rebase(detail) => Failure::new("rebase_failed", detail),
|
||||
})
|
||||
.map_err(restore_failure)
|
||||
.and_then(|restore| to_value(&restore))
|
||||
}
|
||||
|
||||
fn over_value_budget(text: &str) -> bool {
|
||||
/// The closed kinds of a draft restore failure, shared with the rescue copy read as bytes.
|
||||
pub(crate) fn restore_failure(failure: RestoreFailure) -> Failure {
|
||||
match failure {
|
||||
RestoreFailure::UnsupportedVersion(found) => versioned("unsupported_version", found),
|
||||
RestoreFailure::LoneSurrogate(detail) => Failure::new("lone_surrogate", detail),
|
||||
RestoreFailure::Invalid(detail) => Failure::new("invalid", detail),
|
||||
RestoreFailure::Rebase(detail) => Failure::new("rebase_failed", detail),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn over_value_budget(text: &str) -> bool {
|
||||
prescan(text.as_bytes()).values > MAX_JSON_VALUES
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user