mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
Fix: Improve drag-and-drop and SSH path handling (#2808)
* Fix: Correct path handling for dragged files on Windows * Fix: Improve drag-and-drop and SSH path handling
This commit is contained in:
parent
29137fbfec
commit
f1c3edeb75
2 changed files with 18 additions and 3 deletions
|
|
@ -614,7 +614,10 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
|||
e.preventDefault()
|
||||
setIsDraggingOver(false)
|
||||
|
||||
const text = e.dataTransfer.getData("application/vnd.code.uri-list")
|
||||
const textFieldList = e.dataTransfer.getData("text")
|
||||
const textUriList = e.dataTransfer.getData("application/vnd.code.uri-list")
|
||||
// When textFieldList is empty, it may attempt to use textUriList obtained from drag-and-drop tabs; if not empty, it will use textFieldList.
|
||||
const text = textFieldList || textUriList
|
||||
if (text) {
|
||||
// Split text on newlines to handle multiple files
|
||||
const lines = text.split(/\r?\n/).filter((line) => line.trim() !== "")
|
||||
|
|
|
|||
|
|
@ -12,8 +12,20 @@
|
|||
* @returns A mention-friendly path
|
||||
*/
|
||||
export function convertToMentionPath(path: string, cwd?: string): string {
|
||||
// Strip file:// protocol if present
|
||||
let pathWithoutProtocol = path.startsWith("file://") ? path.substring(7) : path
|
||||
// Strip file:// or vscode-remote:// protocol if present
|
||||
let pathWithoutProtocol = path
|
||||
|
||||
if (path.startsWith("file://")) {
|
||||
pathWithoutProtocol = path.substring(7)
|
||||
} else if (path.startsWith("vscode-remote://")) {
|
||||
const protocolStripped = path.substring("vscode-remote://".length)
|
||||
const firstSlashIndex = protocolStripped.indexOf("/")
|
||||
if (firstSlashIndex !== -1) {
|
||||
pathWithoutProtocol = protocolStripped.substring(firstSlashIndex + 1)
|
||||
} else {
|
||||
pathWithoutProtocol = ""
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
pathWithoutProtocol = decodeURIComponent(pathWithoutProtocol)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue