Skip to content

Commit 4a9fb5c

Browse files
committed
SignUrl: Fix verify URL with only _debug query (fix PhpStan checks)
1 parent bde92b7 commit 4a9fb5c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Plugin/SignedUrl.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,14 @@ public function verifyUrl(string $url, bool $allowRedirect = false): array
200200
}
201201

202202
$parsedUrl = $this->normalizeUrl($parsedUrl);
203-
$signedUrl = $this->buildUrl(
204-
['query' => $tokenOffset > 0 ? substr($query, 0, $tokenOffset) : null] + $parsedUrl
205-
);
203+
if ($tokenOffset > 0) {
204+
$parsedUrl['query'] = substr($query, 0, $tokenOffset);
205+
} else {
206+
unset($parsedUrl['query']);
207+
/** @var ParsedUrl $parsedUrl (bypass PhpStan bug) */
208+
}
209+
210+
$signedUrl = $this->buildUrl($parsedUrl);
206211

207212
if ($signedUrl !== $allowedUrl) {
208213
throw new SignedUrlVerificationException('URL doesn\'t match signed URL');

0 commit comments

Comments
 (0)