Skip to content

Commit 3da74b8

Browse files
committed
Fix path building without options
1 parent cd18759 commit 3da74b8

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest]
11-
php: ['8.0', '8.1', '8.2', '8.3']
11+
php: ['8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
1212
name: PHP ${{ matrix.php }} Test on ${{ matrix.os }}
1313
steps:
1414
- name: Checkout

src/UrlBuilder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ public function url(string $src, ?string $extension = null): string
9696
{
9797
$format = $extension ? new ImageFormat($extension) : null;
9898

99-
$opt = implode('/', $this->options);
100-
$path = sprintf('/%s/%s', $opt, $this->source($src, $format));
99+
$path = '/' . implode('/', [
100+
...$this->options,
101+
$this->source($src, $format),
102+
]);
101103

102104
return sprintf('/%s%s', $this->signature($path), $path);
103105
}

tests/UrlBuilderTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ public function signedData(): array
114114
'plain' => '/0c-LLep4C-7PBda91FC_d5nEJpyyGH1qzNuifVFG32k/w:300/h:400/rt:fit/plain/http://example.com/image.jpg',
115115
'encoded' => '/0pEYejprWvTcn8ZeJzbHU91zCGFpWjOHMaWhY57aISs/w:300/h:400/rt:fit/aHR0cDovL2V4YW1w/bGUuY29tL2ltYWdl/LmpwZw.jpg',
116116
],
117+
[
118+
'src' => 'local:///logos/evil_martians.png',
119+
'format' => 'jpg',
120+
'options' => [],
121+
'plain' => '/ULisISQ1rO57bD0OFBi0sQQjngiG5hLM1G8lZNrmFnU/plain/local:///logos/evil_martians.png@jpg',
122+
'encoded' => '/UXBqIs6HQ2FlcNLEcx5V0OGfuujgcBZynk0r500gf7A/bG9jYWw6Ly8vbG9n/b3MvZXZpbF9tYXJ0/aWFucy5wbmc.jpg',
123+
],
117124
];
118125
}
119126

0 commit comments

Comments
 (0)