From 4764a54439e51cc3d3d0858a94a2d03a352a628c Mon Sep 17 00:00:00 2001 From: Pavel Odvody Date: Wed, 17 Jun 2015 13:25:06 +0200 Subject: import/pull: fix pulling by image digest When pulling by image digest the identifiers that were produced by parsing image digest were later overwritten by code parsing image tag. This resulted in invalid identifiers being used when contacting the remote endpoint, resulting in 404. Reported here: http://lists.freedesktop.org/archives/systemd-devel/2015-June/033039.html --- src/import/pull.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/import/pull.c b/src/import/pull.c index ca33d2f3fa..ca7be6be85 100644 --- a/src/import/pull.c +++ b/src/import/pull.c @@ -245,15 +245,15 @@ static int pull_dkr(int argc, char *argv[], void *userdata) { if (digest) { reference = digest + 1; name = strndupa(argv[1], digest - argv[1]); - } - - reference = strchr(argv[1], ':'); - if (reference) { - name = strndupa(argv[1], reference - argv[1]); - reference++; } else { - name = argv[1]; - reference = "latest"; + reference = strchr(argv[1], ':'); + if (reference) { + name = strndupa(argv[1], reference - argv[1]); + reference++; + } else { + name = argv[1]; + reference = "latest"; + } } if (!dkr_name_is_valid(name)) { -- cgit v1.2.3-54-g00ecf