From b7bda84d4939886101b4010842d3975bada09d12 Mon Sep 17 00:00:00 2001 From: "{\"message\":\"Resource not accessible by integration\",\"documentation_url\":\"https://docs.github.com/rest/users/users#get-the-authenticated-user\",\"status\":\"403\"}" <{"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/users/users#get-the-authenticated-user","status":"403"}> Date: Sat, 2 May 2026 01:16:45 +0000 Subject: [PATCH] Standardize drag & drop behavior between Project Explorer and Finder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the inconsistency where files dragged from the Project Explorer were handled differently than files dragged from Finder: - Project Explorer → Input: was inserting relative path without shell escaping or image detection. Now routes through the editor's DragAndDropFiles action (same as Finder), so image files are detected and attached as context, non-image paths are shell-escaped and transformed for WSL, and absolute paths are used consistently. - Project Explorer → Terminal (long-running command): was inserting the absolute path directly without shell escaping or image detection. Now routes through TerminalView::drag_and_drop_files (same as Finder), so shell escaping, WSL path conversion, and SSH file upload all apply. Resolves APP-4360 Co-Authored-By: Oz --- app/src/code/file_tree/view.rs | 23 ++++++++++++++++------- app/src/terminal/input.rs | 14 +++++++++++++- app/src/terminal/view.rs | 2 +- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/app/src/code/file_tree/view.rs b/app/src/code/file_tree/view.rs index 9cb01aa3b..4f3957717 100644 --- a/app/src/code/file_tree/view.rs +++ b/app/src/code/file_tree/view.rs @@ -3089,18 +3089,26 @@ impl TypedActionView for FileTreeView { id, terminal_input_data, } => { - let Some(relative_path) = self.relative_path_for_item(id) else { + let Some(root_dir) = self.root_directories.get(&id.root) else { + return; + }; + let Some(item) = root_dir.items.get(id.index) else { return; }; + // Use the absolute path (consistent with Finder drops) and route + // through the editor's DragAndDropFiles path so that image + // detection, shell escaping, and WSL path transformation all + // apply uniformly regardless of the drop source. + let path = item.path().as_str().to_string(); + let weak_view_handle = terminal_input_data.weak_view_handle(); let Some(input_view) = weak_view_handle.upgrade(ctx) else { return; }; - let file_path = relative_path.to_string_lossy(); input_view.update(ctx, |input_view, ctx| { - input_view.append_to_buffer(&file_path, ctx); + input_view.handle_drag_and_drop_files(vec![path], ctx); }); } FileTreeAction::ItemDroppedOnTerminal { id, terminal_view } => { @@ -3111,15 +3119,16 @@ impl TypedActionView for FileTreeView { return; }; - let path_str = item.path().as_str(); - let Some(terminal_view) = terminal_view.upgrade(ctx) else { return; }; - let file_path = path_str.to_string(); + // Route through the terminal view's drag_and_drop_files so that + // image detection, shell escaping, WSL path conversion, and SSH + // file upload all apply consistently with Finder drops. + let path = item.path().as_str().to_string(); terminal_view.update(ctx, |view, ctx| { - view.handle_file_tree_drop_on_active_command(&file_path, ctx); + view.drag_and_drop_files(&[path], ctx); }); } } diff --git a/app/src/terminal/input.rs b/app/src/terminal/input.rs index eb0ff58a9..0dd0b3cc1 100644 --- a/app/src/terminal/input.rs +++ b/app/src/terminal/input.rs @@ -267,7 +267,7 @@ use warp_core::{ ui::theme::{color::internal_colors, AnsiColorIdentifier}, }; use warp_editor::editor::NavigationKey; -use warp_util::path::ShellFamily; +use warp_util::{path::ShellFamily, user_input::UserInput}; use warpui::{ accessibility::{AccessibilityContent, ActionAccessibilityContent, WarpA11yRole}, clipboard::{ClipboardContent, ImageData}, @@ -7615,6 +7615,18 @@ impl Input { self.system_insert(content, ctx); } + /// Handles file paths dropped from the project explorer by routing them through + /// the editor's DragAndDropFiles action. This ensures consistent behavior with + /// Finder drops: image detection, shell escaping, and path transformation all + /// apply uniformly. + pub fn handle_drag_and_drop_files(&mut self, paths: Vec, ctx: &mut ViewContext) { + self.editor.update(ctx, |editor, ctx| { + let user_paths: Vec> = + paths.iter().map(|p| UserInput::new(p.as_str())).collect(); + editor.handle_action(&EditorAction::DragAndDropFiles(user_paths), ctx); + }); + } + pub fn insert_typeahead_text( &mut self, num_typeahead_chars_inserted: CharOffset, diff --git a/app/src/terminal/view.rs b/app/src/terminal/view.rs index c69adaa46..5974543f6 100644 --- a/app/src/terminal/view.rs +++ b/app/src/terminal/view.rs @@ -23753,7 +23753,7 @@ impl TerminalView { self.cursor_position_id.clone() } - fn drag_and_drop_files(&mut self, paths: &[String], ctx: &mut ViewContext) { + pub fn drag_and_drop_files(&mut self, paths: &[String], ctx: &mut ViewContext) { self.is_file_drop_target = false; if paths.is_empty() { return;