trivial: Clarify the FwupdRelease::checksum is for the container

In one place we were accidentally setting the contents checksum,
because the LVFS was setting the artifact type of 'binary' for metainfo
export -- which was never going to match on the LVFS.
This commit is contained in:
Richard Hughes 2022-07-18 14:24:40 +01:00
parent 19491c02b7
commit 62a62f8f0f
2 changed files with 10 additions and 4 deletions

View File

@ -429,7 +429,7 @@ fwupd_release_has_category(FwupdRelease *self, const gchar *category)
* fwupd_release_get_checksums:
* @self: a #FwupdRelease
*
* Gets the release checksums.
* Gets the release container checksums.
*
* Returns: (element-type utf8) (transfer none): the checksums, which may be empty
*
@ -446,7 +446,7 @@ fwupd_release_get_checksums(FwupdRelease *self)
/**
* fwupd_release_add_checksum:
* @self: a #FwupdRelease
* @checksum: (not nullable): the update checksum
* @checksum: (not nullable): the update container checksum
*
* Sets the update checksum.
*
@ -471,7 +471,7 @@ fwupd_release_add_checksum(FwupdRelease *self, const gchar *checksum)
* @self: a #FwupdRelease
* @checksum: (not nullable): the update checksum
*
* Finds out if the release has the update checksum.
* Finds out if the release has the update container checksum.
*
* Returns: %TRUE if the release matches
*

View File

@ -257,6 +257,12 @@ fu_release_load_artifact(FuRelease *self, XbNode *artifact, GError **error)
/* filename */
filename = xb_node_query_text(artifact, "filename", NULL);
if (!g_str_has_suffix(filename, ".cab")) {
/* some firmware archives was signed with <artifact type="binary"> where the
* checksums were the *content* checksums, not the *container* checksum */
g_debug("ignoring non-binary artifact entry: %s", filename);
return TRUE;
}
if (filename != NULL)
fwupd_release_set_filename(FWUPD_RELEASE(self), filename);
@ -742,7 +748,7 @@ fu_release_load(FuRelease *self,
fwupd_release_add_flag(FWUPD_RELEASE(self), FWUPD_RELEASE_FLAG_IS_COMMUNITY);
/* this is the more modern way to do this */
artifact = xb_node_query_first(rel, "artifacts/artifact", NULL);
artifact = xb_node_query_first(rel, "artifacts/artifact[@type='binary']", NULL);
if (artifact != NULL) {
if (!fu_release_load_artifact(self, artifact, error))
return FALSE;