Skip to content

Commit ff70361

Browse files
committed
Use canonical path and DataModel::from_markdown
Resolve the input path with std::fs::canonicalize and pass the canonical Path to DataModel::from_markdown instead of reading the file into a string and calling from_markdown_string. This normalizes the path and delegates file parsing to DataModel, avoiding an extra read_to_string here.
1 parent 6590ab4 commit ff70361

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/markdown/frontmatter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ impl ImportType {
186186
} else {
187187
path.to_string()
188188
};
189-
let data = std::fs::read_to_string(path)?;
190-
let model = DataModel::from_markdown_string(&data)?;
189+
let path = std::fs::canonicalize(path)?;
190+
let model = DataModel::from_markdown(&path)?;
191191
Ok(model)
192192
}
193193
}

0 commit comments

Comments
 (0)