mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-06 00:12:11 +00:00
fix: handle remote image URLs in paste handler (#4691)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
parent
14e823e938
commit
73eae191e9
1 changed files with 20 additions and 18 deletions
|
|
@ -705,7 +705,8 @@ export function Prompt(props: PromptProps) {
|
||||||
// trim ' from the beginning and end of the pasted content. just
|
// trim ' from the beginning and end of the pasted content. just
|
||||||
// ' and nothing else
|
// ' and nothing else
|
||||||
const filepath = pastedContent.replace(/^'+|'+$/g, "").replace(/\\ /g, " ")
|
const filepath = pastedContent.replace(/^'+|'+$/g, "").replace(/\\ /g, " ")
|
||||||
console.log(pastedContent, filepath)
|
const isUrl = /^(https?):\/\//.test(filepath)
|
||||||
|
if (!isUrl) {
|
||||||
try {
|
try {
|
||||||
const file = Bun.file(filepath)
|
const file = Bun.file(filepath)
|
||||||
if (file.type.startsWith("image/")) {
|
if (file.type.startsWith("image/")) {
|
||||||
|
|
@ -724,6 +725,7 @@ export function Prompt(props: PromptProps) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
const lineCount = (pastedContent.match(/\n/g)?.length ?? 0) + 1
|
const lineCount = (pastedContent.match(/\n/g)?.length ?? 0) + 1
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue