Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Fix #433: open only file URLs handed to the app (macOS 27 turns an https URL into a path)

imachusb7644d31f2f9
diff --git a/apps/vectorcraft/src/open_documents.rs b/apps/vectorcraft/src/open_documents.rs
index b949e9ca8..67f409b0e 100644
--- a/apps/vectorcraft/src/open_documents.rs
+++ b/apps/vectorcraft/src/open_documents.rs
@@ -78,7 +78,8 @@ fn add_open_urls_method() {
/// Queue the files among `urls` and wake the UI. Never panics: it runs inside AppKit.
extern "C-unwind" fn open_urls(_delegate: &AnyObject, _cmd: Sel, _app: &AnyObject, urls: &NSArray<NSURL>) {
- let paths = urls.iter().filter_map(|u| u.to_file_path()).map(|p| p.to_string_lossy().into_owned());
+ // Only file URLs: macOS 27 turns an https URL's path into a file path too (#433).
+ let paths = urls.iter().filter(|u| u.isFileURL()).filter_map(|u| u.to_file_path()).map(|p| p.to_string_lossy().into_owned());
PENDING.lock().unwrap_or_else(PoisonError::into_inner).extend(paths);
if let Some(ctx) = UI.get() {
ctx.request_repaint();