Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/OpenCloud/ObjectStore/Resource/DataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,11 @@ public function getTemporaryUrl($expires, $method, $forcePublicUrl = false)
}
// @codeCoverageIgnoreEnd

$url = ($forcePublicUrl === true) ? $this->getService()->getEndpoint()->getPublicUrl() : $this->getUrl();
$url = $this->getUrl();
if ($forcePublicUrl === true) {
$url->setHost($this->getService()->getEndpoint()->getPublicUrl()->getHost());
}

$urlPath = urldecode($url->getPath());
$body = sprintf("%s\n%d\n%s", $method, $expiry, $urlPath);
$hash = hash_hmac('sha1', $body, $secret);
Expand Down
3 changes: 3 additions & 0 deletions tests/OpenCloud/Tests/ObjectStore/Resource/DataObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public function test_temp_urls_can_be_forced_to_use_public_urls()

// Check that internal URLs are NOT used
$this->assertNotContains('snet-storage', $tempUrl);

// Check that the URL contains the required file path
$this->assertContains('/foo/bar', $tempUrl);
}

public function test_Purge()
Expand Down