Skip to content

Commit 9cdffb7

Browse files
committed
Use contents, not filesystem, to read METADATA.pb
1 parent da1d142 commit 9cdffb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

profile-googlefonts/src/metadata.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use fonts_public::FamilyProto;
66
use fontspector_checkapi::prelude::*;
77

88
fn validate_metadatapb(c: &Testable, _context: &Context) -> CheckFnResult {
9-
let mdpb = std::fs::read_to_string(&c.filename)
10-
.map_err(|e| CheckError::Error(format!("Couldn't open metadata file: {}", e)))?;
9+
let mdpb = std::str::from_utf8(&c.contents)
10+
.map_err(|_| CheckError::Error("METADATA.pb is not valid UTF-8".to_string()))?;
1111
let msg = protobuf::text_format::parse_from_str::<FamilyProto>(&mdpb)
1212
.map_err(|e| CheckError::Error(format!("Error parsing METADATA.pb: {}", e)))?;
1313
let mut problems = vec![];

0 commit comments

Comments
 (0)