address review: OCIO FileTransform files read through the bounded regular-file reader

This commit is contained in:
Dylan M. Taylor
2026-11-11 09:27:02 +00:00
parent 668c0fa193
commit 87222dfc8a
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -284,7 +284,7 @@ pub fn load_file(src: &str) -> Option<Arc<FileXform>> {
parse_file(src, "")
} else {
let ext = std::path::Path::new(src_t).extension().and_then(std::ffi::OsStr::to_str).unwrap_or("");
std::fs::read_to_string(src_t).ok().and_then(|t| parse_file(&t, ext))
crate::utility::read_text_file(std::path::Path::new(src_t)).ok().and_then(|t| parse_file(&t, ext))
}
.map(Arc::new);
if let Ok(mut m) = cache.lock() {
+2
View File
@@ -695,6 +695,8 @@ mod read_text_file_tests {
assert!(std::process::Command::new("mkfifo").arg(&fifo).status().unwrap().success());
// Opening a FIFO with no writer would block: this returns at once.
assert!(super::read_text_file(&fifo).is_err());
// An OCIO FileTransform source reads through the same bounded reader.
assert!(crate::ocio::load_file(&fifo.to_string_lossy()).is_none());
std::fs::remove_dir_all(&dir).unwrap();
}
}