openQA icon indicating copy to clipboard operation
openQA copied to clipboard

Proof of Concept - Link to githubusercontent for image urls

Open perlpunk opened this issue 1 year ago • 4 comments

  • This would need mapping for other providers, so the regex should also be configurable
  • Avoid doing this if test used the latest sha?

Issues:

  • https://progress.opensuse.org/issues/177817
  • https://progress.opensuse.org/issues/162035

perlpunk avatar Feb 25 '25 12:02 perlpunk

@sdclarke maybe you could try this alternative out as well. this is only for viewing needle matches in the test details steps view. needle candidates and needle editor are not changed at all.

perlpunk avatar Feb 25 '25 13:02 perlpunk

Note how Mojo::URL has some issues with parsing git@host:path/to/repo.git urls - the lesser used ssh://git@host/path/to/repo.git style should be fine, though.

Note how [email protected] is detected as a scheme and host is actually empty.

perl> $u = Mojo::URL->new('[email protected]:asdil12/opi.git');
[email protected]:asdil12/opi.git
perl> print Dumper($u);
$VAR1 = bless( {
                 'scheme' => '[email protected]',
                 'query' => bless( {
                                     'charset' => 'UTF-8',
                                     'pairs' => []
                                   }, 'Mojo::Parameters' ),
                 'path' => bless( {
                                    'leading_slash' => !!0,
                                    'trailing_slash' => !!0,
                                    'charset' => 'UTF-8',
                                    'parts' => [
                                                 'asdil12',
                                                 'opi.git'
                                               ]
                                  }, 'Mojo::Path' )
               }, 'Mojo::URL' );
1

perl> $u->path
asdil12/opi.git
perl> $u->host

perl> $u->scheme
[email protected]

Maybe use a regex to convert it to a ssh:// style URL before creating the Mojo::URL object?

aylen384 avatar Feb 26 '25 13:02 aylen384

In my opinion Mojo::URL is parsing [email protected]:asdil12/opi.git correctly because when thinking of that blindly as a generic URL it kind of makes sense to consider [email protected] the scheme. It looks like the JavaScript URL parser behaves differently and just treats everything as a path - but that is also not really correct.

I guess the problem is not in any of those parsers but that [email protected]:asdil12/opi.git is just not really meant to be interpreted as a URL. I guess parsing these kinds of "URLs" using a regex makes sense.

Martchus avatar Feb 26 '25 13:02 Martchus

This pull request is now in conflicts. Could you fix it? 🙏

mergify[bot] avatar May 05 '25 11:05 mergify[bot]