Fix fetch instance software version from nodeinfo (#3772)
authorDenis Dzyubenko <denis@ddenis.info>
Tue, 1 Aug 2023 08:55:28 +0000 (10:55 +0200)
committerGitHub <noreply@github.com>
Tue, 1 Aug 2023 08:55:28 +0000 (10:55 +0200)
Fixes #3771

src/scheduled_tasks.rs

index c44d61f27672d74ba65401663aed3eac4af8ae65..28315beaae815c7bfd36a3858611fbbcc5396f98 100644 (file)
@@ -387,12 +387,13 @@ fn update_instance_software(conn: &mut PgConnection, user_agent: &str) -> LemmyR
       Ok(res) => match res.json::<NodeInfo>() {
         Ok(node_info) => {
           // Instance sent valid nodeinfo, write it to db
+          let software = node_info.software.as_ref();
           Some(
             InstanceForm::builder()
               .domain(instance.domain)
               .updated(Some(naive_now()))
-              .software(node_info.software.and_then(|s| s.name))
-              .version(node_info.version.clone())
+              .software(software.and_then(|s| s.name.clone()))
+              .version(software.and_then(|s| s.version.clone()))
               .build(),
           )
         }