web: point a failed open of a very large drawing to the desktop app

A browser tab gets a few GB of memory at most, so a drawing of a few
hundred MB can fail to open there while the desktop app opens it
(#918). When an open over 150 MB fails in the browser, the command line
now says so and recommends the desktop app.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-15 09:32:20 +03:00
1 parent c8aa179ec0
commit d1a14bef91
24 files changed
+35

No files matched your search

+12
View File
@@ -1421,6 +1421,18 @@ impl OpenCADStudio {
self.queue_next_web_autosave_prompt();
}
}
// A browser tab has a few GB of memory at most; a very large
// drawing that fails here usually opens in the desktop app.
const WEB_LARGE_DRAWING: u64 = 150 * 1024 * 1024;
if outcome.result.is_err() && outcome.size_bytes > WEB_LARGE_DRAWING {
self.command_line.push_info(
crate::tf!(
"This drawing is {} MB, more than the browser version handles reliably. Open it in the desktop app.",
outcome.size_bytes / (1024 * 1024)
)
.as_ref(),
);
}
if let Some(opening) = self.opening.as_mut() {
opening.name = outcome.name.clone();
opening.source_path = Some(std::path::PathBuf::from(&outcome.name));
+1
View File
@@ -2771,6 +2771,7 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
"Recent Documents" => Some(("common", "recent-documents")),
"Recent Files" => Some(("common", "recent-files")),
"Recent file no longer exists: {}" => Some(("common", "recent-file-no-longer-exists")),
"This drawing is {} MB, more than the browser version handles reliably. Open it in the desktop app." => Some(("common", "web-drawing-too-large")),
"Records" => Some(("properties", "records")),
"Rectangle - Center" => Some(("draw", "rectangle-center")),
"Rectangle - Rotated" => Some(("draw", "rectangle-rotated")),