fix(ui): always strip @ for SHIFT+ENTER paths regardless of file attachment
This commit is contained in:
@@ -22,18 +22,13 @@ export function resolvePastedPlaceholders(prompt: string, attachments: Attachmen
|
||||
|
||||
let result = prompt
|
||||
|
||||
// For each path attachment, find and replace @path with path in the prompt
|
||||
// This is more precise than regex and won't affect regular @mentions
|
||||
// For each path attachment (SHIFT+ENTER), find and replace @path with path in the prompt
|
||||
// We ALWAYS strip @ for SHIFT+ENTER paths, even if there's also a file attachment
|
||||
for (const path of pathAttachments) {
|
||||
// Try both with and without trailing slash
|
||||
const variants = [path, path + "/"]
|
||||
|
||||
for (const variant of variants) {
|
||||
// Skip if this path is also a file attachment (should keep @)
|
||||
if (fileAttachments.has(variant) || fileAttachments.has(variant.replace(/\/$/, ""))) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Replace @path with path (exact match)
|
||||
const searchPattern = "@" + variant
|
||||
result = result.split(searchPattern).join(variant)
|
||||
|
||||
Reference in New Issue
Block a user