1
0
Fork 0

Allow using short form URLs like foo.com if they are very simple

pull/12247/head
Jordi Boggiano 2025-01-10 16:42:50 +01:00
parent 7b261bdf53
commit 924527cda6
No known key found for this signature in database
2 changed files with 25 additions and 2 deletions

View File

@ -301,6 +301,11 @@ class GitHubDriver extends VcsDriver
}
if (!array_key_exists('scheme', $bits) && !array_key_exists('host', $bits)) {
if (Preg::isMatch('{^[a-z0-9-]++\.[a-z]{2,3}$}', $item['url'])) {
$result[$key]['url'] = 'https://'.$item['url'];
break;
}
$this->io->writeError('<warning>Funding URL '.$item['url'].' not in a supported format.</warning>');
unset($result[$key]);
break;

View File

@ -288,11 +288,21 @@ class GitHubDriverTest extends TestCase
return [
[
'custom: example.com',
null,
[
[
'type' => 'custom',
'url' => 'https://example.com',
],
],
],
[
'custom: [example.com]',
null,
[
[
'type' => 'custom',
'url' => 'https://example.com',
],
],
],
[
'custom: "https://example.com"',
@ -319,6 +329,10 @@ class GitHubDriverTest extends TestCase
'type' => 'custom',
'url' => 'https://example.com',
],
[
'type' => 'custom',
'url' => 'https://example.org',
],
],
],
[
@ -328,6 +342,10 @@ class GitHubDriverTest extends TestCase
'type' => 'custom',
'url' => 'https://example.com',
],
[
'type' => 'custom',
'url' => 'https://example.org',
],
],
],
];