mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
Support mentioning binary files (#1880)
This commit is contained in:
parent
8663e52e8d
commit
f5628e573f
2 changed files with 10 additions and 5 deletions
5
.changeset/wise-icons-sort.md
Normal file
5
.changeset/wise-icons-sort.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"roo-cline": patch
|
||||
---
|
||||
|
||||
Support mentioning binary files
|
||||
|
|
@ -152,12 +152,12 @@ async function getFileOrFolderContent(mentionPath: string, cwd: string): Promise
|
|||
const stats = await fs.stat(absPath)
|
||||
|
||||
if (stats.isFile()) {
|
||||
const isBinary = await isBinaryFile(absPath).catch(() => false)
|
||||
if (isBinary) {
|
||||
return "(Binary file, unable to display content)"
|
||||
try {
|
||||
const content = await extractTextFromFile(absPath)
|
||||
return content
|
||||
} catch (error) {
|
||||
return `(Failed to read contents of ${mentionPath}): ${error.message}`
|
||||
}
|
||||
const content = await extractTextFromFile(absPath)
|
||||
return content
|
||||
} else if (stats.isDirectory()) {
|
||||
const entries = await fs.readdir(absPath, { withFileTypes: true })
|
||||
let folderContent = ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue