diff options
author | Guillaume Ranquet <granquet@baylibre.com> | 2022-07-04 11:43:16 +0200 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2022-08-25 12:52:39 +0300 |
commit | 97ff3e787fbfb5ff50e3ba787f067829509f7cd2 (patch) | |
tree | 5aa858ddb07758dd1614042e21dad2e901cd3cf9 | |
parent | 824f614a69e55a25d67832593cb8aadb9671e306 (diff) | |
download | meli-97ff3e787fbfb5ff50e3ba787f067829509f7cd2.zip |
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>
-rw-r--r-- | src/conf.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/conf.rs b/src/conf.rs index 2b9aaa27..8bf4c3cb 100644 --- a/src/conf.rs +++ b/src/conf.rs @@ -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)?); + } + } } } } |