dir: Don't waste time reading metadata for the wrong ref

We don't support extensions of extensions, as evidenced by add_related()
only being called once in flatpak_transaction_real_run(), so there's no
need to read the metadata file of an extension in
flatpak_dir_find_local_related(), only to find that it doesn't have any
extensions of its own.
This commit is contained in:
Phaedrus Leeds
2022-03-31 10:59:47 -07:00
committed by Phaedrus Leeds
parent 1f7ff92c51
commit 476b277e5a

View File

@@ -15802,11 +15802,14 @@ flatpak_dir_find_local_related (FlatpakDir *self,
if (deploy_data == NULL)
return NULL;
metadata = g_file_get_child (deploy_dir, "metadata");
if (!g_file_load_contents (metadata, cancellable, &metadata_contents, NULL, NULL, NULL))
if (flatpak_deploy_data_get_extension_of (deploy_data) == NULL)
{
g_debug ("No metadata in local deploy");
/* No metadata => no related, but no error */
metadata = g_file_get_child (deploy_dir, "metadata");
if (!g_file_load_contents (metadata, cancellable, &metadata_contents, NULL, NULL, NULL))
{
g_debug ("No metadata in local deploy");
/* No metadata => no related, but no error */
}
}
}
else