Skip to content

Commit

Permalink
Merge remote-tracking branch 'dfau/fix/invalid-signature'
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Lehmann committed Feb 7, 2024
2 parents 698eaf5 + cac5dd3 commit 89a971c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Classes/Service/UrlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function setCrop(float $width, float $height, string $cropGravityType, fl

public function setFilename(string $filename)
{
$this->options[] = 'fn:' . $filename;
$this->options[] = 'fn:' . $this->encodeUrl($filename) . ':t';
return $this;
}

Expand Down Expand Up @@ -83,7 +83,7 @@ public function setResizeType(string $resizeType)

public function generate(): string
{
$this->options[] = rtrim(strtr(base64_encode($this->sourceUrl), '+/', '-_'), '=');
$this->options[] = $this->encodeUrl($this->sourceUrl);
$unsignedPath = '/' . implode('/', $this->options);

if (!empty($this->key)) {
Expand All @@ -98,4 +98,9 @@ public function generate(): string

return $url;
}

protected function encodeUrl(string $url): string
{
return rtrim(strtr(base64_encode($url), '+/', '-_'), '=');
}
}

0 comments on commit 89a971c

Please sign in to comment.