trim whitespace from /etc/timezone

This commit is contained in:
Scott Lamb 2021-09-24 10:49:04 -07:00
parent 0c0c0692f3
commit 82102c0d17
2 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,10 @@ changes, see Git history.
Each release is tagged in Git and on the Docker repository
[`scottlamb/moonfire-nvr`](https://hub.docker.com/r/scottlamb/moonfire-nvr).
## unreleased
* trim whitespace when detecting time zone by reading `/etc/timezone`.
## `v0.6.6` (2021-09-23)
* fix [#146](https://github.com/scottlamb/moonfire-nvr/issues/146): "init

View File

@ -149,9 +149,9 @@ fn resolve_zone() -> Result<String, Error> {
}
};
// If `TIMEZONE_PATH` is a file, use its contents as the zone name.
// If `TIMEZONE_PATH` is a file, use its contents as the zone name, trimming whitespace.
match ::std::fs::read_to_string(TIMEZONE_PATH) {
Ok(z) => Ok(z),
Ok(z) => Ok(z.trim().to_owned()),
Err(e) => {
bail!(
"Unable to resolve timezone from TZ env, {}, or {}. Last error: {}",