All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit e0b5257a authored by Leigh B Stoller's avatar Leigh B Stoller

Watch for an image URL that refers to the image itself instead of

an image version.
parent 88efdca5
......@@ -57,6 +57,8 @@ use Data::Dumper;
use Date::Parse;
use POSIX qw(strftime);
use Time::Local;
use URI;
use URI::QueryParam;
use Project;
# Configure variables
......@@ -606,6 +608,30 @@ sub GetImageInfo($)
"left join images as i on ".
" i.image_uuid=v.image_uuid ".
"where v.metadata_url=$safe_url");
if (defined($query_result) && !$query_result->numrows()) {
#
# See if the url is for the image instead of a specific
# version.
#
my $uri = URI->new($url);
my $uuid = $uri->query_param("uuid");
if ($uuid) {
$query_result =
$DB->QueryWarn("select i.*,v.* ".
" from image_versions as v ".
" inner join ".
" (select image_uuid, ".
" max(version) as version ".
" from image_versions ".
" where image_uuid='$uuid' ".
" group by image_uuid) as ij ".
" on v.image_uuid=ij.image_uuid and ".
" v.version=ij.version ".
"left join images as i on ".
" i.image_uuid=v.image_uuid");
}
}
}
return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED)
if (!defined($query_result) ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment