8000 [Assets] Allows empty base url for dev · symfony/symfony@e3ac469 · GitHub
[go: up one dir, main page]

Skip to content

Commit e3ac469

Browse files
GromNaNfabpot
authored andcommitted
[Assets] Allows empty base url for dev
1 parent 3d8efd5 commit e3ac469

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/Symfony/Component/Asset/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.1
5+
---
6+
7+
* `UrlPackage` accepts empty strings as `base_url`, in order to simplify local dev configuration.
8+
49
6.0
510
---
611

src/Symfony/Component/Asset/Tests/UrlPackageTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public function getContextConfigs()
8585

8686
[true, ['http://example.com'], '', 'foo', 'http://example.com/foo?v1'],
8787
[true, ['http://example.com', 'https://example.com'], '', 'foo', 'https://example.com/foo?v1'],
88+
[true, ['', 'https://example.com'], '', 'foo', '/foo?v1'],
8889
];
8990
}
9091

src/Symfony/Component/Asset/UrlPackage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private function getSslUrls(array $urls)
117117
{
118118
$sslUrls = [];
119119
foreach ($urls as $url) {
120-
if (str_starts_with($url, 'https://') || str_starts_with($url, '//')) {
120+
if (str_starts_with($url, 'https://') || str_starts_with($url, '//') || '' === $url) {
121121
$sslUrls[] = $url;
122122
} elseif (null === parse_url($url, \PHP_URL_SCHEME)) {
123123
throw new InvalidArgumentException(sprintf('"%s" is not a valid URL.', $url));

0 commit comments

Comments
 (0)
0