Merge pull request #94 from Miyabi-G-K/feature/issue-91-obsidian-utf8-fix

fix(protocol): handle non-UTF-8 in Obsidian vault
This commit is contained in:
林 駿甫 (Shunsuke Hayashi) 2026-04-10 10:16:01 +09:00 committed by GitHub
commit 2733aa9552
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1241,7 +1241,13 @@ fn read_file_snippet(path: &Path, max_lines: usize) -> Result<String, Error> {
let reader = BufReader::new(file);
let mut lines = Vec::new();
for line in reader.lines().take(max_lines) {
lines.push(line?);
match line {
Ok(l) => lines.push(l),
Err(_) => {
// Non-UTF-8 file (binary) — return what we have so far
break;
}
}
}
Ok(lines.join("\n"))
}