mirror of
https://github.com/flatpak/flatpak.git
synced 2026-01-27 17:18:11 -05:00
image-source: Make flatpak_image_source_new public
And check that the digest is a sha256 hash. Will be used in the next commits.
This commit is contained in:
@@ -32,6 +32,12 @@ G_DECLARE_FINAL_TYPE (FlatpakImageSource,
|
||||
FLATPAK, IMAGE_SOURCE,
|
||||
GObject)
|
||||
|
||||
FlatpakImageSource *flatpak_image_source_new (FlatpakOciRegistry *registry,
|
||||
const char *repository,
|
||||
const char *digest,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
FlatpakImageSource *flatpak_image_source_new_local (GFile *file,
|
||||
const char *reference,
|
||||
GCancellable *cancellable,
|
||||
|
||||
@@ -68,7 +68,7 @@ flatpak_image_source_init (FlatpakImageSource *self)
|
||||
{
|
||||
}
|
||||
|
||||
static FlatpakImageSource *
|
||||
FlatpakImageSource *
|
||||
flatpak_image_source_new (FlatpakOciRegistry *registry,
|
||||
const char *repository,
|
||||
const char *digest,
|
||||
@@ -78,6 +78,12 @@ flatpak_image_source_new (FlatpakOciRegistry *registry,
|
||||
g_autoptr(FlatpakImageSource) self = NULL;
|
||||
g_autoptr(FlatpakOciVersioned) versioned = NULL;
|
||||
|
||||
if (!g_str_has_prefix (digest, "sha256:"))
|
||||
{
|
||||
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Only sha256 image checksums are supported"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self = g_object_new (FLATPAK_TYPE_IMAGE_SOURCE, NULL);
|
||||
self->registry = g_object_ref (registry);
|
||||
self->repository = g_strdup (repository);
|
||||
|
||||
Reference in New Issue
Block a user