From 2c2e78b56bb3f33ea287453b1c6212a02bfca0e9 Mon Sep 17 00:00:00 2001 From: naskya Date: Fri, 21 Jun 2024 10:20:33 +0900 Subject: [PATCH] fix revision check logic --- src/command/config.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/command/config.rs b/src/command/config.rs index 36f9088..5895bec 100644 --- a/src/command/config.rs +++ b/src/command/config.rs @@ -72,6 +72,8 @@ fn current_revision() -> Result { let server_config_revision = toml::from_str::(&buffer)?.config_revision; + buffer.clear(); + let mut client_toml = fs::File::open(CLIENT_CONFIG_PATH)?; client_toml.read_to_string(&mut buffer)?; @@ -83,7 +85,12 @@ fn current_revision() -> Result { )); } - Ok(server_config_revision) + match server_config_revision { + Revision::V0 => Err(RevisionCheckError::UnknownRevision( + "revision 0 does not exist", + )), + _ => Ok(server_config_revision), + } } pub(crate) async fn run(command: Commands) -> Result<(), ConfigError> {