better symlink handling

This commit is contained in:
Robin Appelman 2026-02-26 15:30:00 +01:00
commit d4887f3ea8

View file

@ -17,7 +17,7 @@ use osc94::Progress;
use rayon::prelude::*;
use std::borrow::Cow;
use std::collections::HashMap;
use std::fs::File;
use std::fs::{canonicalize, File};
use std::io::{read_to_string, stdin, BufReader, Stderr, Write};
use std::iter::once;
use std::sync::atomic::{AtomicUsize, Ordering};
@ -90,6 +90,11 @@ fn main() -> MainResult {
})?;
LogFile::from_string(content)
} else {
let path = canonicalize(path)?;
let path = path
.into_os_string()
.into_string()
.map_err(|_| "non utf8 path")?;
let file = File::open(&path)?;
let file = BufReader::new(file);
LogFile::open(&path, file).map_err(|err| LogError::Read { err, path })?