Skip to content

Commit ac63eed

Browse files
committed
Allow schemeless ip address as job url
When creating a Mojo::URL object without a schema, the whole string is seen as a path, so it for 10.20.30.40/tests/42 it would be a path with three elements '10.20.30.40', 'tests', '42'. Then the first item containing a digit is taken as a match for the job id. use Mojo::URL; use Data::Dumper; my $url = Mojo::URL->new("10.20.30.40/x/y"); say Dumper $url; __END__ $VAR1 = bless( { 'path' => bless( { 'trailing_slash' => '', 'parts' => [ '10.20.30.40', 'x', 'y' ], 'leading_slash' => '', 'charset' => 'UTF-8' }, 'Mojo::Path' ) }, 'Mojo::URL' ); Issue: https://progress.opensuse.org/issues/184735
1 parent 9b87196 commit ac63eed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/OpenQA/Script/CloneJob.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ sub clone_job_download_assets ($jobid, $job, $url_handler, $options) {
175175
}
176176

177177
sub split_jobid ($url_string) {
178+
# handle scheme being omitted and support specifying only a domain (e.g. 'openqa.opensuse.org')
179+
$url_string = "http://$url_string" unless $url_string =~ m{https?://};
178180
my $url = Mojo::URL->new($url_string);
179181

180-
# handle scheme being omitted and support specifying only a domain (e.g. 'openqa.opensuse.org')
181-
$url->scheme('http') unless $url->scheme;
182182
$url->host($url->path->parts->[0]) unless $url->host;
183183

184184
my $host_url = Mojo::URL->new->scheme($url->scheme)->host($url->host)->port($url->port)->to_string;

0 commit comments

Comments
 (0)