conf.rs: only add toml files to the themes

By default, all files under MELI_CONFIG/themes are added to the
configuration files.
If one of these files is a binary file, this will provoke an error.

Summary: InvalidData
stream did not contain valid UTF-8
Caused by: stream did not contain valid UTF-8
Kind: OS Errorthread 'main' panicked at 'failed', melib/src/error.rs:201:9

Fixes the potential issue by filtering by file extension.

Signed-off-by: Guillaume Ranquet <granquet@baylibre.com>
tables
Guillaume Ranquet 2022-07-04 11:43:16 +02:00 committed by Manos Pitsidianakis
parent 824f614a69
commit 97ff3e787f
1 changed files with 6 additions and 1 deletions

View File

@ -879,7 +879,12 @@ mod pp {
for theme_mailbox in xdg_dirs.find_config_files("themes") {
let read_dir = std::fs::read_dir(theme_mailbox)?;
for theme in read_dir {
ret.push_str(&pp_helper(&theme?.path(), 0)?);
let file = theme?.path();
if let Some(extension) = file.extension() {
if extension == "toml" {
ret.push_str(&pp_helper(&file, 0)?);
}
}
}
}
}