fix revision check logic

This commit is contained in:
naskya 2024-06-21 10:20:33 +09:00
parent e6b287d377
commit 2c2e78b56b
Signed by: naskya
GPG key ID: 712D413B3A9FED5C

View file

@ -72,6 +72,8 @@ fn current_revision() -> Result<Revision, RevisionCheckError> {
let server_config_revision = toml::from_str::<Config>(&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<Revision, RevisionCheckError> {
));
}
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> {